πŸ’Ž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-All rights


🧠 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

  1. Mimic Domain Controller: The attacker poses as a legitimate Domain Controller

  2. Request Replication: Uses DS-Replication-Get-Changes-All extended right

  3. Extract Secrets: Retrieves NTLM hashes, Kerberos keys, and cleartext passwords

  4. No Detection: Appears as legitimate DC-to-DC replication traffic

Required Privileges

To perform DCSync, you need an account with:

  • Replicating Directory Changes permission

  • Replicating Directory Changes All permission

  • DS-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.107

  • RDP 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:

  1. User with reversible encryption: syncron

  2. syncron cleartext password: Mycleart3xtP@ss!

  3. 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

  1. DCSync Theory: Understanding DS-Replication-Get-Changes rights and domain replication protocol

  2. Multi-Platform Execution: Both Linux (secretsdump.py) and Windows (Mimikatz) approaches

  3. Advanced Enumeration: Reversible encryption detection and cleartext password extraction

  4. 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