> 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/nosql-injection/detection-of-nosql-injection.md).

# اكتشاف حقن NoSQL

### اكتشاف حقن NoSQL

**هدف المختبر**

يحتوي هذا المختبر على تطبيق تجارة إلكترونية يعتمد مرشح الفئات فيه على قاعدة بيانات **مونغو دي بي (NoSQL)**. / تسمح لك ثغرة حقن NoSQL بعرض **المنتجات غير المنشورة**.

الهدف هو استغلال هذه الثغرة لإجبار التطبيق على إرجاع جميع المنتجات، بما في ذلك تلك التي لا ينبغي أن تكون مرئية.

**سياق التطبيق**

* صفحة تجارة إلكترونية تحتوي على مرشح واحد حسب الفئة.
* مثال على طلب عادي

```bash
filter?category=Accessories
```

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

**تحديد الثغرة**

عند إضافة **علامة اقتباس مفردة** في نهاية `category` المعامل، يعيد الخادم خطأً داخليًا:

```bash
خطأ داخلي في الخادم
فشل الأمر مع الخطأ 139 (JSInterpreterFailure):
SyntaxError: سلسلة نصية غير منتهية....
```

<figure><img src="/files/0a0d87e1561726eb934984a5a1427a8ae6b5bf73" alt=""><figcaption></figcaption></figure>

يكشف هذا الخطأ عدة عناصر مهمة:

* يستخدم الجزء الخلفي **MongoDB**.
* تُفسَّر مدخلات المستخدم في **JavaScript** سياق على جانب قاعدة البيانات.
* التطبيق معرّض لثغرة \*\*حقن NoSQL\*\*.

**استغلال حقن NoSQL**

الهدف هو التلاعب بالشرط المستخدم في طلب MongoDB بحيث يكون صحيحًا دائمًا.

أمثلة على الحمولة التي تم اختبارها:

```sql
' || 1==1 || '
' || true || '
' && 0 && '
```

هذه التعابير تجعل الشرط صحيحًا، مما يؤدي إلى عرض \*\*جميع المنتجات\*\* بما في ذلك غير المنشورة

<figure><img src="/files/8881382a23c7ae04902b6f9b95db93ad892e99ad" alt=""><figcaption></figcaption></figure>

#### حمولات غير فعّالة (للمقارنة)

```sql
' && 0 && '
' || 1==2 || '
```

تُقيَّم هذه الشروط على أنها خاطئة ولا تُرجع أي منتجات

<figure><img src="/files/9f6e1890c1d0c6397a21ceabc2c540c823848c5f" 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/nosql-injection/detection-of-nosql-injection.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.
