# NTDS.dit secrets

## 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. &#x20;

## 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.&#x20;

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.&#x20;

* <https://github.com/fortra/impacket/blob/master/examples/secretsdump.py>

The following command will dump the NTDS.dit data:&#x20;

`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.&#x20;

secretsdump.py performs various techniques to dump password hashes and secrets.&#x20;

* <https://github.com/fortra/impacket/blob/master/examples/secretsdump.py>

**The following command will dump hashes from NTDS.dit**

`secretsdump.py -just-dc-ntlm <DOMAIN>/<USER>@<TARGET>`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.pentestlist.com/offensive-security/internal-infrastructure/credential-discovery/ntds.dit-secrets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
