Table of Contents
DCSync is a technique for stealing the Active Directory password database by using the built-in Directory Replication Service Remote Protocol, which is used by Domain Controllers to replicate domain data. This allows an attacker to mimic a Domain Controller to retrieve user NTLM password hashes.
The crux of the attack is requesting a Domain Controller to replicate passwords via the DS-Replication-Get-Changes-All extended right. This is an extended access control right within AD, which allows for the replication of secret data.
To perform this attack, you must have control over an account that has the rights to perform domain replication (a user with the Replicating Directory Changes and Replicating Directory Changes All permissions set). Domain/Enterprise Admins and default domain administrators have this right by default.
Honestly the HTB’s DCSync note has all the data needed to perform this attack. I wouldn’t add or remove anything from it right now.
Syntax
Below are two syntaxes for starting the attack itself.
Performing the attack with Mimikatz
privilege::debug
lsadump::dcsync /domain:DOMAIN.COM /user:DOMAIN\marioPerforming the attack with secretsdump.py
secretsdump.py -outputfile dc_hashes -just-dc INLANEFREIGHT/adunn@172.16.5.5 - Basic usage
secretsdump.py -just-dc -outputfile dc_hashes \ -hashes :NTLM_HASH \ 'INLANEFREIGHT/adunn@172.16.5.5' - DCSync with the use of an NTLM hash
Tips
- We can use the
-just-dc-ntlmflag if we only want NTLM hashes or specify-just-dc-user <USERNAME>to only extract data for a specific user. Other useful options include-pwd-last-setto see when each account’s password was last changed and-historyif we want to dump password history, which may be helpful for offline password cracking or as supplemental data on domain password strength metrics for our client. The-user-statusis another helpful flag to check and see if a user is disabled.