> 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/race-conditions/race-conditions-that-bypass-limits.md).

# حالات السباق التي تتجاوز الحدود

### حالات سباق تجاوز الحد

يتضمن مسار الشراء **حالة سباق** تتيح لك الحصول على **سعر غير متوقع** وقت الدفع.

#### الهدف

اشترِ بنجاح **سترة جلدية خفيفة L33t**.

#### البيانات / المتطلبات المسبقة

* بيانات الاعتماد: `wiener:peter`
* رمز الخصم (20%): `PROMO20`
* الرصيد المتاح: **$50**

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

* تكلفة السترة: **$1300**

<figure><img src="/files/631df56c8bdeccdf723c0df98bf90962fb1cad93" alt=""><figcaption></figcaption></figure>

### ملاحظة السلوك

1. أضف السترة إلى سلة التسوق.
2. طبّق `PROMO20` القسيمة.
3. إذا حاولت تطبيق القسيمة للمرة الثانية، يجيب التطبيق: **تم تطبيق القسيمة بالفعل**.

<figure><img src="/files/349810f9768eac221ca023e230b3f7f48be46089" alt="" width="563"><figcaption></figcaption></figure>

يبدو طلب تطبيق القسيمة كالتالي (نموذج مُرمّز بـ URL):

```bash
csrf=7QYFGBaACc8P5YOfUHR4S85oo95uA0Vb&coupon=PROMO20
```

### الاستغلال اليدوي (Burp Repeater)

1. أرسل طلب التطبيق إلى **Repeater**.
2. أنشئ **المجموعة** في Repeater.

<figure><img src="/files/4a1cc81d9569d0325369ca4af31a207f5038e6a3" alt="" width="563"><figcaption></figcaption></figure>

* انسخ علامة تبويب الطلب /\~20 مرة (**تكرار علامة التبويب**).

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

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

إرسال الطلبات **بالتوازي**.

<figure><img src="/files/84804d58f3acad2419e277abd217078b21aecb0e" alt=""><figcaption></figcaption></figure>

النتيجة هي أن معظم الطلبات **تم التحقق منها**، ويصبح الإجمالي **/\~37**، مما يتيح لك الشراء رغم السعر الأصلي ($1300) والرصيد المحدود.

<figure><img src="/files/30dec2fe029f32fb15d15d41a19687e8fb8a45ee" alt=""><figcaption></figcaption></figure>

### الاستغلال الآلي (إجراء مخصص في Burp Suite Pro)

توصي المختبر باستخدام **إطلاق حالات السباق** (Burp Suite Professional) عبر **إجراء مخصص**.

#### 1) إضافة سكربت (مكتبة Bambda)

انتقل إلى **الامتدادات → مكتبة Bambda** وأضف:

* **المعرّف**: `eb57d5bd-33e2-4a8c-bf51-bc81bd26613a`
* **معلمة**: `التحقق من حالة السباق`
* **الدالة**: `CUSTOM_ACTION`
* **الموقع**: `REPEATER`

```javascript
id: eb57d5bd-33e2-4a8c-bf51-bc81bd26613a
الاسم: التحقق من حالة السباق
الدالة: CUSTOM_ACTION
الموقع: REPEATER
المصدر: |+
  /**
  * يكرر الطلب 10 مرات لإطلاق حالات السباق أو تهريب الطلبات، باستخدام هجوم الحزمة الواحدة لـ HTTP/2، والمزامنة عند البايت الأخير لـ HTTP/1
  *
  * @المؤلف James Kettle
  **/
  int NUMBER_OF_REQUESTS = 10;
  var reqs = new ArrayList<HttpRequest>();
  for (int i = 0; i < NUMBER_OF_REQUESTS; i++) {
      reqs.add(requestResponse.request());
  }

  var responses = api().http().sendRequests(reqs);
  var codes = responses.stream().map(HttpRequestResponse::response).map(HttpResponse::statusCode).toList();
  logging().logToOutput(codes);
```

<figure><img src="/files/947b52680b259df4ceea60c331b961a0f7afd43e" alt=""><figcaption></figcaption></figure>

#### 2) التشغيل من Repeater

1. في Repeater: **إجراء مخصص** → أضف من العينات.

<figure><img src="/files/ef01c832a9055a8f7937aee4eb692387ecd57ebc" alt="" width="548"><figcaption></figcaption></figure>

* تم تحميل الإجراء المخصص الذي تم إنشاؤه.

<figure><img src="/files/698e28c4b1cfb1a4fefb8917f66b4630286883c3" alt=""><figcaption></figcaption></figure>

اختبر باستخدام **30 طلبًا**.

نرى **رموز الحالة** (لـ 30 شحنة) ويمكننا إطلاق حالة السباق بسهولة أكبر

<figure><img src="/files/e5408375dc04f77ea62179218d477ddc28b71fb5" 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/race-conditions/race-conditions-that-bypass-limits.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.
