Updated on 13 Feb, 2025
When securing an enterprise network, one of the most critical components to protect is the Domain Controller (DC). This server manages authentication and identity services across an organization's Windows domain, making it a prime target for attackers. Once adversaries gain Domain Administrator credentials, one of their top priorities is extracting the NTDS.DIT file—a database that holds the keys to the kingdom by storing user credentials and password hashes.
------------------------------------------------------------------------------------------------------------
What is the NTDS.DIT File?
NTDS.DIT is the Active Directory (AD) database, containing account credentials, including password hashes, for all domain users. These hashes are in NT format (and sometimes LM format for older systems). Attackers highly value this file because it allows them to extract passwords, reuse credentials, and launch further attacks within the network.
By default, NTDS.DIT is stored in the following location:
%SystemRoot%\NTDS
However, administrators can configure a custom path, which is recorded in the registry at:
HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters
-----------------------------------------------------------------------------------------------------------
Why is NTDS.DIT Extraction Dangerous?
Extracting NTDS.DIT provides an attacker with complete control over an enterprise network.
With the password hashes from this file, they can:
Perform Pass-the-Hash (PtH) Attacks – Using a valid hash instead of a plaintext password to authenticate.
Crack Passwords Offline – Attempting to recover plaintext passwords using hash-cracking tools.
Create Golden Tickets – Forging Kerberos authentication tickets to maintain persistent access.
-----------------------------------------------------------------------------------------------------------
How Attackers Extract NTDS.DIT
Since NTDS.DIT is a protected system file, it cannot be simply copied like a regular document. Attackers use various techniques to bypass these restrictions:
1. Using Built-in Windows Tools (ntdsutil)
The ntdsutil command-line tool can create backups of the NTDS.DIT database. However, administrative privileges are required.
2. Bypassing Windows API Protections
Some tools can load custom drivers or interact with raw disk data, avoiding standard security mechanisms. This method requires special drivers or privilege escalation.
3. Using Volume Shadow Copy (Most Popular Method)
The Volume Shadow Copy Service (VSS) allows attackers to create a backup of the NTDS.DIT file without triggering security alerts. If no shadow copies exist, attackers can simply create one and extract the file from the snapshot.
Steps in Volume Shadow Copy Extraction:
Check if a shadow copy exists:
vssadmin list shadows
If no shadow copy exists, create one:
vssadmin create shadow /for=C:
Locate and copy NTDS.DIT from the shadow copy:
copy \?\GLOBALROOT\Device\HarddiskVolumeShadowCopyX\Windows\NTDS\ntds.dit C:\temp\ntds.dit
Extract SYSTEM and SAM registry hives to decrypt the data:
reg save HKLM\SYSTEM C:\temp\SYSTEM reg save HKLM\SAM C:\temp\SAM
Use secretsdump.py (Impacket) to extract hashes:
python secretsdump.py -ntds ntds.dit -system SYSTEM LOCAL
4. Using Third-Party or Open-Source Tools'
Several open-source tools facilitate NTDS.DIT extraction, such as:
Impacket’s secretsdump.py – Extracts hashes from NTDS.DIT.
Mimikatz – Can retrieve password hashes and even plaintext credentials.
NTDSXtract – Parses NTDS.DIT offline for analysis.
-----------------------------------------------------------------------------------------------------------
Preventing NTDS.DIT Extraction
Because NTDS.DIT extraction gives attackers full domain control, prevention is critical.
1. Monitor and Restrict Administrative Access
Implement least privilege access (only necessary users should have admin rights).
Monitor privileged account activity and look for unusual authentication attempts.
Use Privileged Access Management (PAM) solutions to limit credential exposure.
2. Disable and Monitor Volume Shadow Copies
Prevent attackers from creating shadow copies by disabling unnecessary VSS instances.
Regularly check for unauthorized shadow copies using:
vssadmin list shadows
Restrict access to vssadmin and wmic for non-administrative users.
3. Enable LSASS Protection
LSASS (Local Security Authority Subsystem Service) stores credential information.
Enforce LSASS protection to prevent credential dumping:
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v RunAsPPL /t REG_DWORD /d 1 /f
4. Detect and Block NTDS.DIT Exfiltration Attempts
Use SIEM (Security Information and Event Management) tools to detect suspicious activities like:
Unauthorized access to ntds.dit
Use of vssadmin or ntdsutil by non-admin users
Set up endpoint detection rules for tools like Mimikatz and secretsdump.py.
5. Enable Strong Authentication Policies
Implement multi-factor authentication (MFA) to reduce the impact of credential theft.
Enforce strong, unique passwords across the domain to prevent hash reuse.
-----------------------------------------------------------------------------------------------------------
Conclusion
NTDS.DIT extraction is one of the most dangerous attacks against enterprise environments. If an attacker gains access to this database, they can effectively control the entire network. Protecting domain controllers, monitoring privileged accounts, and proactively defending against credential theft are essential strategies for preventing such devastating breaches.
-----------------------------------------Dean-----------------------------------------------
Comments