> 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/authentication/2fa-bypass-via-brute-force.md).

# تجاوز المصادقة الثنائية عبر القوة الغاشمة

### تجاوز المصادقة الثنائية باستخدام هجوم القوة الغاشمة

يحتوي هذا المختبر على عاملين قابلين لهجوم القوة الغاشمة. / معرّفات المستخدم معروفة بالفعل، لكن رمز التحقق للمصادقة الثنائية غير قابل للوصول. / الهدف هو تخمين رمز MFA من أجل الوصول إلى حساب **كارلوس**.

* **ضحية**: `carlos`
* **كلمة المرور**: `مونتويا`

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

**سياق مصادقة 2FA**

بعد اتصال ناجح باستخدام اسم المستخدم وكلمة المرور، يتطلب التطبيق رمز MFA.

يبدو استعلام جهة الخادم كما يلي:

```bash
csrf=pqkmb1Cny2T3wbbgKEdqZPweWFpyCv0A&mfa-code=1234
```

**المشكلة التي تمت مواجهتها**

* عند اختبار عدة رموز MFA، يشير الخادم إلى أن **رمز CSRF لم يعد صالحًا**.

<figure><img src="/files/ed88a64aa6b63bfc2e96600d46874c6b690c3189" alt="" width="464"><figcaption></figcaption></figure>

* ثم يعيد التطبيق التوجيه تلقائيًا إلى صفحة تسجيل الدخول.

مع كل وصول جديد إلى صفحة تسجيل الدخول، يتم **إنشاء رمز CSRF جديد** .

وهذا يمنع هجوم قوة غاشمة مباشرًا على `mfa-code` المعامل.

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

**إعداد الحل (Burp Suite)**

لتجاوز هذا الحماية، يتم استخدام **ماكرو** لإعادة توليد رمز CSRF صالح تلقائيًا في كل محاولة.

<figure><img src="/files/62089143b829af048b0d5429e395a16bd69965a4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1a7727f70bc389de93e5e4c3f31e8cd148980fe4" alt="" width="461"><figcaption></figcaption></figure>

**الخطوات:**

1. أنشئ جديدًا **ماكرو** في Burp Suite.

<figure><img src="/files/daae099cc38199fa623e88ca919d4cae04451f09" alt="" width="459"><figcaption></figcaption></figure>

* قم بتضمين الطلبات التالية في الماكرو:
* `GET /login`
* `POST /login`
* `GET /login2`

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

1. تحقق من أن الماكرو يسمح باستخراج **إنشاء رمز CSRF جديد** في كل تنفيذ.

<figure><img src="/files/72f77d1f0fcfcbd27e369d7823cb987d7488f246" alt=""><figcaption></figcaption></figure>

الماكرو جاهز ويعمل الآن.

**هجوم القوة الغاشمة على رمز MFA**

1. اعترض `طلب POST` الاستعلام الذي يحتوي على `mfa-code` المعامل.

<figure><img src="/files/8cb15444cd4c457152f283116691ba6d5e8b0ca8" alt=""><figcaption></figcaption></figure>

* أرسل هذا الطلب إلى **Intruder**.
* اضبط الحمولة على حقل `mfa-code` .
* اضبط نطاقًا من القيم من **0000 إلى 9999**، بتنسيق **4 أرقام مطلوبة**.

<figure><img src="/files/f892c68edabc00c4e44d0e7d0c632f23b8a74192" alt="" width="394"><figcaption></figcaption></figure>

اربط الماكرو بحيث يتم **تحديث رمز CSRF تلقائيًا** مع كل استعلام.

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

**النتيجة**

* يتغير رمز CSRF بشكل صحيح مع كل محاولة.
* عند اختبار رمز MFA صالح، يختلف رد الخادم.
* يمكن التعرف على الرمز الصحيح من خلال **`302 Found`** استجابة، مما يشير إلى إعادة توجيه ناجحة إلى حساب المستخدم.

<figure><img src="/files/6e63d67658630b4a2bc069fe811e6161e37de318" 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/authentication/2fa-bypass-via-brute-force.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.
