> 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-via-abnormal-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 %}

نلاحظ أن:

* الـ `الاستدعاء` يُستخدم الوسيط لتعريف الدالة التي سيتم استدعاؤها.
* ثم يتم تنفيذ القيمة الممرَّرة على جانب العميل.

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

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

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

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

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

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

نفرض **معاملًا جديدًا `الاستدعاء`** في جسم طلب 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/cache-poisoning-via-abnormal-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.
