Example Analysis of Spring Boot Actuator from Unauthorized Access to getshell


Preface department bosses dug this hole in a src, which is an old hole. I found it interesting, so I set up an environmental test in the local area.

Actuator is a functional module provided by springboot to introspect and monitor the application system. With the help of Actuator, developers can easily check and count some monitoring indicators of the application system. When the Actuator is enabled, illegal users can access the default actuator endpoints to obtain monitoring information in the application system, which will lead to information leakage and even the server being taken over.

Actuator is a functional module provided by Spring Boot, which can be used for introspection and monitoring application systems. The provided executor endpoints are divided into two categories: native endpoints and user-defined extension endpoints. The native endpoints mainly include:


Getshell with env and refresh by thinking

Use mappings to find unauthorized interfaces.

Use trace to obtain authentication information (Cookie, cookie, Session), and use authentication information to access the interface.

Env may reveal the database account password (mangodb), of course, it is less likely to open the external network.

Foreigners say that they can execute sql statements, but they don't understand it at present.

Vulnerability discovery usually identifies the framework used by current web applications as springboot framework. There are two main ways to judge:

Through the icon (favicon.ico) of the webpage label of the web application; If the web application developer has not modified the default icon of the springboot web application, you can see the following default small green icon after entering the application homepage:

Default error page through springboot framework; If the web application developer doesn't modify the default 4xx and 5xx error pages of springboot web application, when 4xx and 5xx errors occur in the web application, the following errors will be reported (here, only the 404 error page is taken as an example): Visit a randomly constructed path, such as http:/, and the following error page will appear to explain the use of the web site.

Combining the above two ways to judge whether the current web application is a springboot framework is to visit different directories to see if there are small green leaf icons, and then try to trigger 4xx or 5xx errors of the application in different directories to see if there are Whitelabel Error Page.

Vulnerabilities use access /trace endpoints to obtain basic HTTP request tracking information (timestamp, HTTP header, etc.). If there is an operation request of the login user, a cookie can be forged to log in.

Visit the /env endpoint to get all the environmental attributes. Because the actuator will monitor the database services such as mysql and mangodb, the monitoring information can sometimes be used to monitor the mysql and mangodb database information. If the database happens to be open in the public network, the harm caused is enormous.

Improper configuration of /env endpoint causes RCE,

Preconditions: Eureka-Client, for example, testing json at the front desk to reveal the package name is to use netflix.

The following two packages are required.

Spring-boot-starter-actuator (/refresh required to refresh the configuration)

Spring-cloud-starter-Netflix-Eureka-client (functional dependency)

Using python3 to start a script, we need to pay attention to two places, one is the ip and port of the receiving shell, and the other is the port started by our script.

Nc listens to a port to receive the bounce shell.

Write the configuration, visit the /env endpoint, and grab the package to change the get request into a post request. The post content is (the ip is the ip of the machine started by the script):


Then visit /refresh, grab the package and change the get request into a post request, and the post data is arbitrary.

Then in our nc window, we can see that a shell bounced back successfully.

As a security dog, vulnerability repair can't just dig without repairing, and introduce the spring-boot-starter-security dependency under the pom.xml file of the project.


Then open the security function in application.properties, configure the password of the access account, and restart the application to pop up.


If the interface is disabled, it can be set as follows (such as disabling the env interface):

endpoints.env.enabled= false

The foreigner said that he could execute the sql statement and found that he couldn't. Maybe the method was useless. I took a picture of him, hoping to share it with the bosses who successfully executed it.

In the actual environment, it is found that many commands cannot be executed because there is no refresh, and there is no breakthrough at present.

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us