Exploring Spring Boot Secret Gold Mine
Hello, Readers👋 I’m Jacob Hazak and today, I will be writing about Spring boot.
The Spring Framework (Spring) is an open-source application framework providing infrastructure support for Java applications. As one of the most popular Java Enterprise Edition (Java EE) frameworks, Spring enables developers to build high-performing, POJO-based applications.
Spring Framework’s Actuators
Spring Framework provides developers with robust “actuators” to manage and monitor web applications. Actuators enable auditing, health monitoring, and metrics gathering. While these features are excellent, they can pose security risks when enabled and misconfigured in a production environment, potentially opening backdoors to your server.
Except for /health
and /info
, all actuator endpoints can expose application configuration data, logs, and control messages.
- /heapdump: Displays heap dumps potentially containing sensitive data like database credentials.
- /threaddump: Displays thread dumps, including stack trace.
- /trace: Shows the last few HTTP messages, which could include session identifiers.
- /logfile: Outputs contents of application logs that may contain non-public details.
- /shutdown: Shuts the application down.
- /mappings: Shows all the MVC controller mappings.
- /env: Provides access to the configuration environment.
- /restart: Restarts the application.
Spring docs contain a complete list of these endpoints.
Spring Boot Security
Heap dumps may accidentally expose credentials, or worse, threat actors might use them to modify the application environment properties or shut down your application. When a web-accessible application is in play, the security implications of using actuator endpoints need careful consideration.
If you need to collect metrics, secure spring boot actuator endpoints like any other sensitive endpoint. Suppose you want to define custom rules, such as allowing users with a specific role to access them. In that case, Spring boot provides convenient RequestMatcher objects for use with spring security. Always ensure that actuator endpoints are secure.
We recommend disabling spring actuator endpoints in production environments. If necessary for monitoring, only expose harmless endpoints like /health
.
Hacking Spring Boot Actuator Endpoints
As I mentioned earlier, Spring Boot Actuator is a subproject of the Spring Boot Framework that provides additional features for monitoring and managing Spring Boot applications.
It exposes operational information about the running application, such as health, metrics, info, dump, and environment properties. These actuators include many built-in endpoints that allow you to monitor and interact with your applications.
During a recent audit, we discovered that the Spring Boot Actuator was enabled, exposing multiple endpoints that disclosed sensitive information about the environment’s properties and related infrastructure. This vulnerability presents a significant risk, as an attacker could exploit it to explore additional attack surfaces and extract secrets from memory to gain unauthorized access.
In particular, the heap dump endpoint is a critical vulnerability.
A malicious user can use this endpoint to download heap dumps containing sensitive information from system memory. This include passwords and other secrets that an attacker can leverage to gain unauthorized access to the system.
Conclusion
Spring boot actuator endpoints offer valuable features for monitoring applications, but they also introduce security concerns. Therefore, enabling these endpoints by default in production is not recommended. However, if you need to enable actuators, protect these endpoints just like any other sensitive data endpoints.
Thank you for reading. 👏
Like & Follow us on Twitter @ZeroDefenseLabs and @kobsoNinja to stay updated and share your thoughts and for expert penetration testing, don’t hesitate to get in touch with us.