> 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/web-cache-poisoning-via-fat-get-request.md).

# تسميم ذاكرة التخزين المؤقت للويب عبر طلب GET ضخم

### تسميم ذاكرة التخزين المؤقت للويب عبر طلب GET كبير

هذا المختبر عرضة لتسميم ذاكرة التخزين المؤقت للويب لأنه يقبل **طلبات GET التي تحتوي على جسم**، لكن **لا يتم تضمين الجسم في مفتاح ذاكرة التخزين المؤقت**. / يزور مستخدم الصفحة الرئيسية للموقع بانتظام باستخدام Chrome. / الهدف هو تسميم ذاكرة التخزين المؤقت بحيث يُشغِّل الرد `alert(1)` في متصفح الضحية.

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

من خلال اعتراض الطلب إلى الصفحة الرئيسية، نلاحظ وجود ملف تعريف الارتباط التالي

<pre class="language-http"><code class="lang-http"><strong>الكوكيز: country=[object Object]
</strong></code></pre>

تم إنشاء ملف تعريف الارتباط هذا من ملف JavaScript الذي تحمله الصفحة:

```bash
/js/geolocate.js
```

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

**تحليل `geolocate.js`**

الوصول إلى ما يلي مباشرةً:/ `/js/geolocate.js?callback=setCountryCookie`

تم الحصول على الكود التالي:

{% code overflow="wrap" %}

```javascript
const setCountryCookie = (country) => {
    document.cookie = 'country=' + country;
};
const setLangCookie = (lang) => {
    document.cookie = 'lang=' + lang;
};
setCountryCookie"({"country":"المملكة المتحدة"});
```

{% endcode %}

نلاحظ أن:

* الـ `callback` يُستخدم المعامل لتحديد الدالة التي يتم استدعاؤها.
* تُنفَّذ القيمة الممرَّرة بعد ذلك على جانب العميل.

**استغلال الثغرة**

عند تحميل الصفحة الرئيسية، يستدعي الموقع تلقائيًا:/ `/js/geolocate.js?callback=setCountryCookie`

من خلال استغلال حقيقة أن:

* الخادم يقبل طلبات GET التي تحتوي على جسم.
* لا يتم تضمين الجسم في مفتاح ذاكرة التخزين المؤقت.

```bash
callback=alert(1)
```

<figure><img src="/files/51703d4e6fb8e6eba0cfea52795c86fa90e32b81" alt=""><figcaption></figcaption></figure>

نفرض **معاملًا جديدًا `callback`** في جسم طلب GET، ونعطيه القيمة التالية:

<figure><img src="/files/5d594b64ab2d343d92cf2611ec1bb8b56817dc06" alt=""><figcaption></figcaption></figure>

الاستجابة المخزنة مؤقتًا تحتوي الآن على الاستدعاء إلى `alert(1)`.

<figure><img src="/files/687b30fa3ef72e18f6ac0bb3581d730c37972001" 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/web-cache-poisoning-via-fat-get-request.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.
