DCSync Attack
Abuse Active Directory replication rights to remotely dump password hashes from the domain controller.
DCSync simulates a domain controller and requests password data, allowing complete domain compromise without touching the DC’s disk.
Quick Reference
# Impacket secretsdump |
Impacket Secretsdump
# DCSync all users |
Mimikatz DCSync
# Start Mimikatz |
Running as Different User (Windows)
# Spawn PowerShell as user with DCSync rights |
Check for DCSync Permissions
PowerView
# Get user SID |
BloodHound
# Query for users with DCSync rights |
Required Permissions
DCSync requires these replication rights:
DS-Replication-Get-Changes(GUID: 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2)DS-Replication-Get-Changes-All(GUID: 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2)DS-Replication-Get-Changes-In-Filtered-Set(GUID: 89e95b76-444d-4c62-991a-0facbeda640c)
Grant DCSync Rights (if you have WriteDACL)
# Import PowerView |
Common Workflow
# Step 1: Identify user with DCSync rights |
Extracting Specific Data
# Get only administrator hash |
Parsing Output
# Extract NTLM hashes only |
Reversible Encryption Passwords
# DCSync will decrypt reversible encryption passwords |
Notes
What is DCSync?
DCSync abuses the Directory Replication Service (DRS) protocol:
- Attacker authenticates as user with replication rights
- Requests password data via DRS
- DC responds with NTLM hashes and Kerberos keys
- No need to access NTDS.dit file directly
Why It Works:
- Domain Controllers replicate data between each other
- Replication uses DRS protocol
- Any account with replication rights can request data
- DC doesn’t distinguish between real DC and attacker
Default Accounts with DCSync Rights:
- Domain Admins
- Enterprise Admins
- Administrators
- Domain Controllers
- Read-Only Domain Controllers (limited)
Required Permissions:
Three replication rights needed:
- Replicating Directory Changes: Basic replication
- Replicating Directory Changes All: Includes sensitive data
- Replicating Directory Changes In Filtered Set: For RODC
Detection:
Event IDs to monitor:
- 4662: Operation performed on object
- Look for replication GUIDs
- From non-DC computers
- By non-DC accounts
- 5136: Directory service object modified
- 4624: Account logon
Indicators:
- Replication requests from workstations
- Replication by user accounts (not computer accounts)
- Multiple replication requests in short time
- Replication outside maintenance windows
Advantages over NTDS.dit Extraction:
- No need for DC access
- No file system interaction
- Works remotely
- Faster than copying NTDS.dit
- Less likely to trigger alerts
- No need to stop services
Output Files:
Secretsdump creates multiple files:
.ntds: NTLM hashes and Kerberos keys.ntds.cleartext: Reversible encryption passwords.ntds.kerberos: Kerberos keys only
Hash Format:
domain\username:RID:LM_HASH:NTLM_HASH::: |
Example:
DOMAIN\administrator:500:aad3b435b51404eeaad3b435b51404ee:88ad09182de639ccc6579eb0849751cf::: |
Kerberos Keys:
DCSync also extracts Kerberos keys:
- AES256
- AES128
- DES (if enabled)
- RC4 (same as NTLM hash)
krbtgt Account:
Special importance:
- Used for Golden Ticket attacks
- Should be changed regularly
- Compromise = full domain compromise
- Two krbtgt accounts in domain (current and previous)
Reversible Encryption:
Some accounts store passwords with reversible encryption:
- Legacy compatibility feature
- Passwords encrypted with RC4
- Key stored in registry (Syskey)
- DCSync automatically decrypts them
- Check with:
userAccountControl -band 128
Post-DCSync Actions:
- Pass-the-Hash: Use NTLM hashes for lateral movement
- Golden Ticket: Use krbtgt hash for persistence
- Password Cracking: Crack hashes offline
- Credential Analysis: Find password patterns
- Privilege Escalation: Identify high-value accounts
Mitigation (for defenders):
- Limit replication rights to DCs only
- Monitor for 4662 events
- Use Protected Users group
- Implement tiered admin model
- Regular krbtgt password rotation
- Enable Advanced Audit Policy
- Use Microsoft ATA/Defender for Identity
Best Practices:
- Always output to file for analysis
- Extract krbtgt immediately
- Document all extracted hashes
- Check for password reuse
- Identify high-value accounts
- Clean up artifacts if possible
Comparison with Other Techniques:
| Technique | Access Required | Stealth | Speed |
|---|---|---|---|
| DCSync | Replication rights | Medium | Fast |
| NTDS.dit copy | DC file access | Low | Slow |
| Volume Shadow Copy | DC admin | Low | Medium |
| ntdsutil | DC admin | Low | Medium |
Common Errors:
- “Access Denied”: User lacks replication rights
- “RPC Server unavailable”: Firewall blocking
- “Target not found”: Wrong DC name/IP
- “Authentication failed”: Wrong credentials
Advanced Usage:
# DCSync through SOCKS proxy |
Cleanup:
DCSync leaves minimal artifacts:
- Event logs (if auditing enabled)
- Network traffic (DRS protocol)
- Authentication logs
- No files created on DC
- No services installed