NTDS.dit secrets
How to find sensitive data in NTDS.dit.
Overview
Windows domain controllers use a database file known as NTDS.dit (Windows NT Directory Services), to store Active Directory data and use it to manage domain and network resources. This file is very powerful with secrets extraction, as the extracted data can be used for many attack paths.
Local Dumping (With or Without Credentials)
Dumping NTDS.dit
NTDS.dit can be dumped locally using the Windows ntdsutil.exe tool. This tool saves a snapshot of the Active Directory data. To use this tool, you must be on a domain controller via credentialled login or have gained access without credentials via other means.
The following command should be used:
powershell "ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp' q q"
After executing ntdsutil.exe, the NTDS.dit, SYSTEM and SECURITY registry hives will be in c:\temp:
Credential Extraction
To extract the data from NTDS.dit, secretsdump.py can be used which performs various techniques to dump password hashes and secrets.
The following command will dump the NTDS.dit data:
secretsdump.py -system SYSTEM -security SECURITY -ntds ntds.dit local
Remotely Dumping (With Credentials)
NTDS.dit can be dumped remotely using secrets-dump. However, a domain administrator is required.
secretsdump.py performs various techniques to dump password hashes and secrets.
The following command will dump hashes from NTDS.dit
secretsdump.py -just-dc-ntlm <DOMAIN>/<USER>@<TARGET>
Last updated