> 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/business-logic/low-level-logic-flaw.md).

# فشل منطقي منخفض المستوى

### خلل في تطبيق قواعد الأعمال

**وصف المختبر**

يحتوي هذا المختبر على \*\*خلل منطقي في عملية الشراء\*\*. بسبب التطبيق السيئ لقواعد التجارة، من الممكن التلاعب بحساب السلة من أجل شراء "Lightweight l33t leather jacket" بسعر غير متوقع.

المعرّف المزوَّد:

* **المستخدم:** wiener
* **كلمة المرور:** peter

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

عند إضافة منتج إلى السلة، يُستخدم الاستعلام التالي:

```bash
productId=1&redir=PRODUCT&quantity=99
```

يمكن إرسال هذه المعلمة **عددًا كبيرًا من المرات** دون تحكم صارم في القيمة التراكمية.

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

يُرسل الاستعلام إلى **Intruder** مع تكوين حمولة فارغة في **استمر إلى ما لا نهاية** الوضع، وبحد أقصى **طلب متزامن واحد**.

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

بعد عدد كافٍ من التكرارات، **يصبح السعر الإجمالي للسلة سالبًا**.

<figure><img src="/files/04533a70b26b5057ae45b696299ed7bc96277bcb" alt=""><figcaption></figcaption></figure>

**سبب المشكلة**

تأتي الثغرة من عدد صحيح موقّع **تجاوز سعة**. / يستخدم التطبيق **عددًا صحيحًا موقّعًا على 32 بت**، وحدوده هي:

* القيمة الدنيا: `-2 147 483 648`
* القيمة القصوى: `2 147 483 647`

عندما يتجاوز الإجمالي القيمة القصوى المسموح بها، فإنه **يعيد الحساب بقيم سالبة** بسبب تجاوز حسابي.

**ضوابط غير كافية**

حتى إذا كان التطبيق يمنع الدفع عندما يكون الإجمالي أقل من 0، **لا يتم إجراء تحقق صحيح أثناء الحسابات الوسيطة**.

يتيح لك هذا تعديل السلة حتى تحصل على مبلغ نهائي موجب لكنه منخفض جدًا.

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

**تعديل الحساب النهائي**

للحصول على مبلغ \*\*أعلى من 0 دولار وأقل من 100 دولار\*\*، يتم إجراء الحساب التالي:

* تكلفة السترة: **$1,337**
* القيمة المطلوبة للتسبب في تجاوز السعة: \**14 018 329* \*
* الحساب:

  ```bash
  14 018 329 / 1337 ≈ 10 484 مرة
  ```

الإرسال على دفعات (`الكمية = 99`):

```bash
10,484 / 99 ≈ 105 طلبًا
```

**التركيبة النهائية للسلة**

للحصول على إجمالي صالح بعد تجاوز السعة:

* **32 123** سترات بسعر 1337 دولارًا
* **21** أحذية رعاية الأطفال بسعر 60.79 دولارًا
* **الإجمالي النهائي:** **$54.63**


---

# 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/business-logic/low-level-logic-flaw.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.
