> 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/reflection-free-detection-of-changed-properties.md).

# اكتشاف الخصائص المتغيرة دون انعكاس

### اكتشاف تلوّث النموذج الأوّلي على جانب الخادم دون انعكاس الخاصية الملوّثة

**سياق المختبر**

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

الهدف: **تأكيد الثغرة** بصفتـ `Object.prototype` المُلوِّث **مرئي لكنه غير مُدمِّر**، فقط عبر تغيير في سلوك الخادم (لا حاجة لاستغلال إضافي).

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

<figure><img src="/files/695a09cafe818870f65beb06b0f9eb6228277ee7" alt=""><figcaption></figcaption></figure>

**البيانات المُرسلة من التطبيق (العنوان)**

من خلال تعديل عنوان الفوترة / التسليم، يرسل المتصفح JSON مشابهًا إلى:

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

**ولِّد خطأً مُتحكَّمًا به لملاحظة الاستجابة**

إذا فرضت خطأً في تحليل JSON (مثلًا بحذف علامة اقتباس)، فستحصل على استجابة **400** ويُرجع الخادم كائن خطأ حيث إن `الجسم` يحتوي على حمولتنا (انعكاس):

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

استجابة نموذجية:

```json
{
  "error": {
    "expose": true,
    "statusCode": 400,
    "status": 400,
    "body": "{/"address_line_1/":/"Wiener HQ/",/"address_line_2/":/"One Wiener Way/",/"city/":/"Wienerville/",/"postcode/":/"BU1 1RP/",/"country/":/"UK/",/"sessionId/":/"P72CQIVn4eYngmsyw4efwGYTXt3RSMrU/r/n}",
    "type": "entity.parse.failed"
  }
}
```

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

**الفكرة: إثبات التلوّث دون انعكاس مباشر**

بدلًا من انتظار رؤية خاصية ملوّثة تُعاد إلى المتن، يمكن السعي إلى **تغيّر قابل للقياس في السلوك**، مثل \*\*رمز HTTP\*\* المُعاد أثناء حدوث خطأ.

هنا، يستخدم الخادم (أو يمرّر) حقولًا مثل `الحالة` / `رمز الحالة`. إذا نجحنا في تلويث `Object.prototype.status`، فسيتمكن Express (أو معالج الخطأ) في الأخطاء اللاحقة من استرجاع هذه القيمة عبر سلسلة النموذج الأوّلي → سيُرجع الخادم قيمة مختلفة **الحالة**.

**محاولة التلوّث عبر `__proto__`**

ملف `__proto__` يُحقن المفتاح في JSON (ضمن استعلام JSON صالح، وليس استعلامًا مكسورًا)، على سبيل المثال:

```json
{
  "address_line_1": "مقر وينر",
  "address_line_2": "طريق وينر الأول",
  "city": "وينرفيل",
  "postcode": "BU1 1RP",
  "country": "المملكة المتحدة",
  "sessionId": "P72CQIVn4eYngmsyw4efwGYTXt3RSMrU,
  "__proto__": {
    "status": 405
    }
}
```

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

التأثير المتوقع: بعد هذا التلوّث، **أي خطأ** (مثلًا خطأً متعمّدًا في تحليل JSON) يمكنه الآن أن يستجيب بـ **405 بدلًا من 400**، لأن `الحالة` موروث من `Object.prototype`.

**النتيجة / التحقق**

* قبل التلوّث: الأخطاء → `400`
* بعد التلوّث: الأخطاء → `405` (أو أي رمز آخر تم اختياره)

<figure><img src="/files/86a404da05aadc6e6bc24cfb3347bef40f0837cf" 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/reflection-free-detection-of-changed-properties.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.
