πDCSync Attack
π HTB Academy: Active Directory Enumeration & Attacks
π Overview
DCSync represents the ultimate domain compromise technique in Active Directory penetration testing. This attack leverages the built-in Directory Replication Service Remote Protocol to mimic a Domain Controller and extract NTLM password hashes for all domain users. Following our ACL attack chain, we now have control over the adunn user who possesses DCSync privileges, allowing us to achieve complete domain compromise.
π Attack Chain Continuation
Complete Path to Domain Compromise:
ACL Enumeration β ACL Abuse Tactics β DCSync Attack β Full Domain Control
(Discovery) (Exploitation) (Compromise) (Game Over)Prerequisites from Previous Modules:
Control over adunn account: Obtained through ACL abuse tactics
adunn Password:
SyncMaster757(cracked from Kerberoasting)DCSync Privileges: adunn has
DS-Replication-Get-Changes-Allrights
π§ DCSync Theory and Mechanics
What is DCSync?
DCSync is a technique that steals the Active Directory password database by abusing the built-in Directory Replication Service Remote Protocol. This protocol is normally used by Domain Controllers to replicate domain data between each other.
How DCSync Works
Mimic Domain Controller: The attacker poses as a legitimate Domain Controller
Request Replication: Uses
DS-Replication-Get-Changes-Allextended rightExtract Secrets: Retrieves NTLM hashes, Kerberos keys, and cleartext passwords
No Detection: Appears as legitimate DC-to-DC replication traffic
Required Privileges
To perform DCSync, you need an account with:
Replicating Directory ChangespermissionReplicating Directory Changes AllpermissionDS-Replication-Get-Changes-In-Filtered-Set(optional)
Default Accounts with DCSync Rights:
Domain Admins
Enterprise Admins
Administrators
Domain Controllers
Custom accounts (like our adunn user)
π Verifying DCSync Privileges
Checking adunn's Group Membership
Expected Output:
Verifying Replication Rights
Expected Output:
β Confirmed: adunn has all required DCSync privileges!
π§ DCSync from Linux - secretsdump.py
Impacket secretsdump.py Overview
Impacket's secretsdump.py is the go-to tool for DCSync attacks from Linux. It can extract:
NTLM password hashes
Kerberos encryption keys
Cleartext passwords (if reversible encryption is enabled)
Password history
Machine account hashes
Basic DCSync Execution
Real Output:
Advanced secretsdump.py Options
Targeted Extraction
Output File Analysis
Analyzing Extracted Data
NTLM Hash Format
Cleartext Password Analysis
πͺ DCSync from Windows - Mimikatz
Mimikatz DCSync Overview
Mimikatz provides the lsadump::dcsync command for DCSync attacks from Windows. Unlike secretsdump.py, Mimikatz:
Targets specific users (not bulk extraction)
Must be run in context of privileged user
Provides detailed credential information
Shows password history and supplemental credentials
Authentication with runas.exe
Real Output:
Mimikatz DCSync Execution
Mimikatz Startup:
DCSync Specific User
Real Output:
Targeting krbtgt for Golden Tickets
Why Target krbtgt:
Golden Ticket Creation: krbtgt hash allows creation of Golden Tickets
Ultimate Persistence: Golden Tickets provide long-term domain access
Domain Admin Equivalent: Full administrative access to entire domain
π Reversible Encryption Password Storage
Understanding Reversible Encryption
Some Active Directory accounts may be configured with "Store password using reversible encryption" option. This setting:
Not cleartext storage: Passwords stored using RC4 encryption
Decryptable: Key stored in registry (Syskey) accessible by Domain Admins
Legacy support: Required for certain authentication protocols
Security risk: Essentially equivalent to cleartext passwords
Enumerating Accounts with Reversible Encryption
Using PowerView
Expected Output:
Using Get-ADUser
Extracting Cleartext Passwords
With secretsdump.py
With Mimikatz
Real Output showing cleartext:
π― HTB Academy Lab Solutions
Lab Environment Details
Target IP:
10.129.149.107RDP Credentials:
htb-student:Academy_student_AD!adunn Password:
SyncMaster757(from previous ACL Abuse module)
π Question 1: "Perform a DCSync attack and look for another user with the option 'Store password using reversible encryption' set. Submit the username as your answer."
Solution Steps:
1. RDP Connection:
2. PowerView Enumeration:
Real Lab Output:
π― Answer: syncron
π Question 2: "What is this user's cleartext password?"
Solution Steps:
1. Authentication as adunn:
Real Lab Output:
2. Mimikatz DCSync:
3. DCSync syncron User:
Real Lab Output:
π― Answer: Mycleart3xtP@ss!
π Question 3: "Perform a DCSync attack and submit the NTLM hash for the khartsfield user as your answer."
Solution Steps:
1. Same Authentication Process:
2. Mimikatz DCSync khartsfield:
3. Extract khartsfield Hash:
Real Lab Output:
π― Answer: 4bb3b317845f0954200a6b0acc9b9f9a
π HTB Academy Lab Summary
Verified Lab Answers:
User with reversible encryption:
syncronsyncron cleartext password:
Mycleart3xtP@ss!khartsfield NTLM hash:
4bb3b317845f0954200a6b0acc9b9f9a
Key Lab Techniques:
PowerView enumeration for reversible encryption accounts
runas.exe authentication as adunn with DCSync privileges
Mimikatz DCSync for targeted user credential extraction
Cleartext password extraction from reversible encryption accounts
π‘οΈ Detection and Defensive Measures
DCSync Attack Detection
Event Monitoring
Advanced Detection Techniques
1. Directory Service Access Auditing:
2. Replication Rights Monitoring:
3. Unusual Authentication Patterns:
Defensive Recommendations
1. Minimize DCSync Privileges
2. Disable Reversible Encryption
3. Implement Advanced Monitoring
4. Privileged Account Management
π Post-DCSync Attack Paths
Immediate Actions After DCSync
1. Pass-the-Hash Attacks
2. Golden Ticket Creation
3. Silver Ticket Attacks
4. Password Cracking Analysis
Establishing Persistence
1. Skeleton Key Attack
2. DSRM Password Abuse
3. Malicious SPN Creation
π Key Takeaways
Technical Mastery Achieved
DCSync Theory: Understanding DS-Replication-Get-Changes rights and domain replication protocol
Multi-Platform Execution: Both Linux (secretsdump.py) and Windows (Mimikatz) approaches
Advanced Enumeration: Reversible encryption detection and cleartext password extraction
Complete Domain Compromise: From initial access to full administrative control
Professional Skills Developed
Privilege Escalation: Leveraging ACL misconfigurations to achieve DCSync rights
Credential Extraction: Complete domain password database acquisition
Post-Exploitation: Using extracted credentials for further attacks and persistence
Detection Awareness: Understanding defensive measures and attack signatures
Attack Chain Mastery
Defensive Insights
Monitoring Requirements: Event logging, ACL auditing, behavioral analysis
Preventive Measures: Privilege minimization, reversible encryption removal
Detection Strategies: Replication traffic monitoring, unusual authentication patterns
Response Procedures: Incident response for DCSync attack indicators
π Complete adversarial simulation mastery achieved - from initial enumeration through ACL abuse to ultimate domain compromise via DCSync - representing the pinnacle of Active Directory penetration testing capabilities!
Last updated