Skip to content

Impacket: The Windows Network Attack Toolkit

Impacket explained: the Python toolkit for Windows network protocols, what its best-known scripts reveal in a pentest report, and the fixes.

Mark KissBy , Founder & CEOUpdated 9 min read

Active Directory Security AssessmentFrom $6,000Fixed scope, free retest, no hourly billing.

Get my fixed price

Impacket is a collection of Python tools for talking to Windows network protocols at a low level, and, in the hands of a tester or an attacker, for abusing them. It is not a single program but a toolkit of scripts, each automating a specific technique against Active Directory and Windows services. If NetExec is the Swiss-army knife of internal testing, Impacket is the drawer of precision instruments underneath it, and much of the tooling in this space is built on top of it.

Here is what it does and, if its scripts appear in a report against your environment, what each one is telling you.

What it actually is

Impacket implements the Windows network protocols (SMB, MSRPC, Kerberos, LDAP, NTLM) directly in Python, so a tester can speak them precisely rather than relying on Windows to do it for them. That low-level control is what enables the attacks: when you control the protocol, you can use it in ways the designers assumed only trusted systems would.

It is delivered as a set of named scripts, and the script names show up in engagement reports. Knowing what each one does tells you exactly what technique was used against you.

Impacket is open source and maintained by Fortra. As of November 2026 the current release is 0.13.1 (May 2026), and recent releases keep adding scripts, which is why a report may name one you have not seen before. The core set below has been stable for years. MITRE ATT&CK tracks the toolkit as software S0357.

Where Impacket runs: Linux, Windows and Python

Impacket is a Python library, so it runs wherever Python does. Most testers run it from Linux; the README recommends installing it with pipx and provides a Docker image. It runs on Windows too, though there testers more often use native tools: Rubeus does the Kerberos work of GetUserSPNs.py and getTGT.py.

Nothing is installed on the machines being tested: the scripts reach them over the network with a valid credential. Antivirus flags Impacket as a hacking tool because real intruders use the same code. A CISA advisory describes an intrusion at a defense contractor where the actors used wmiexec.py and smbexec.py.

The scripts that matter, and what they mean

  • secretsdump.py: extracts password hashes and secrets from a system or domain: local SAM hashes, cached credentials, and, with the right access, the entire Active Directory password database (NTDS.dit). If this appears in a report, an attacker reached a position to dump credentials at scale. It is one of the most serious findings on this list. Against a domain controller it uses DCSync: it asks the controller to replicate password data as another domain controller would, so nothing runs on the controller. Mimikatz does the same job from inside a host.
  • psexec.py / smbexec.py / wmiexec.py / atexec.py: remote command execution on Windows hosts using different built-in mechanisms (Windows services, SMB, WMI, scheduled tasks). Their presence means a valid credential was turned into code execution on a target. The variety exists so a tester can choose the method least likely to be blocked or logged. All four are lateral movement techniques.
  • GetUserSPNs.py: performs Kerberoasting: requests service tickets whose encryption can be cracked offline to recover service-account passwords. A finding here means service accounts with weak passwords are exposed.
  • GetNPUsers.py: performs AS-REP roasting: targets accounts with Kerberos pre-authentication disabled, whose hashes can be requested and cracked offline. A specific misconfiguration with a specific fix.
  • ntlmrelayx.py: automates NTLM relay attacks: captures authentication and relays it to another system to act as the victim. This is why SMB signing and channel binding matter; a finding here means they were missing. The authentication being relayed is usually captured first with Responder and LLMNR poisoning.
  • ticketer.py / getST.py: forge and manipulate Kerberos tickets (Golden and Silver ticket techniques), typically demonstrating persistence after a significant compromise.

Impacket scripts at a glance

The same scripts in one table, plus five more that appear in reports:

Script Technique (ATT&CK ID) What it proves Fix
secretsdump.py Credential dumping (T1003.002 to .004), DCSync (T1003.006) Remote access to credential stores Tiered admin, restrict replication rights
psexec.py, smbexec.py Service execution (T1569.002) Local admin on the target LAPS, no shared local admin
wmiexec.py, dcomexec.py, atexec.py WMI (T1047), DCOM (T1021.003), scheduled task (T1053.005) Same, by another route Restrict remote admin protocols
GetUserSPNs.py Kerberoasting (T1558.003) Crackable service accounts Managed service accounts, AES only
GetNPUsers.py AS-REP roasting (T1558.004) Pre-authentication disabled Re-enable it
ntlmrelayx.py SMB relay (T1557.001) A service accepted relayed NTLM Signing, channel binding, EPA
ticketer.py, getST.py, getTGT.py Kerberos tickets (T1558) Keys or hashes could mint tickets Rotate krbtgt twice, fix delegation
findDelegation.py, lookupsid.py Account discovery (T1087.002) Any user can list accounts and delegation Remove unconstrained delegation
mssqlclient.py SQL Server client A credential worked on a database Least-privilege logins

What its use reveals about your network

Every Impacket finding points at a concrete, fixable weakness:

  • secretsdump succeeded: an account reached a domain controller or a host with cached high-value credentials. Investigate privilege and tiering.
  • Command-execution scripts worked: a credential had remote-execution rights across hosts. Tighten local admin rights and use LAPS.
  • Kerberoasting or AS-REP roasting returned crackable hashes: service and user accounts use weak passwords, or pre-authentication is disabled. Strong passwords for service accounts and managed service accounts fix this.
  • ntlmrelayx worked: the service it relayed to did not require signing or channel binding. Relay also targets LDAP and HTTP services, so the fix has three parts: enforce SMB signing, require LDAP signing and LDAP channel binding on domain controllers, and turn on Extended Protection for Authentication (EPA) on web services that accept NTLM, such as AD CS web enrollment.

None of these are software vulnerabilities in the patch-me sense. They are the structural weaknesses of a real Active Directory environment. That is exactly what an internal test exists to find. Each has a matching check in our Active Directory hardening checklist.

How defenders detect it

Impacket’s techniques are noisy if you are watching the right telemetry:

  • secretsdump does not read LSASS memory. It reads the SAM and SECURITY registry hives remotely and, against a domain controller, replicates the directory (DCSync). Both leave recognizable traces: high-fidelity alerts when monitored.
  • The execution scripts create services, scheduled tasks, or WMI processes with detectable signatures (Windows Event IDs 7045, 4698, and process-creation logs).
  • Kerberoasting shows as service-ticket requests (Event ID 4769) for many service accounts in a short window.
  • NTLM relay is mitigated structurally by enforcing SMB signing and LDAP channel binding, which is better than detecting it after the fact.

Detecting Impacket: event IDs by script

Script Where to look Signal
secretsdump.py (DCSync) Domain controller, Event ID 4662 Replication rights used by a host that is not a domain controller; Microsoft Defender for Identity raises a Suspected DCSync attack alert
secretsdump.py (SAM, LSA) Target, Event ID 5145 Remote registry access over the winreg pipe
psexec.py, smbexec.py Target, Event IDs 7045 and 5145 New randomly named service, writes to ADMIN$
atexec.py Target, Event ID 4698 Task created and deleted within seconds
wmiexec.py, dcomexec.py Event ID 4688 or Sysmon 1 cmd.exe started by WmiPrvSE.exe or a DCOM host
GetUserSPNs.py Domain controller, Event ID 4769 Many ticket requests from one account, often RC4
GetNPUsers.py Domain controller, Event ID 4768 Pre-authentication type 0
ntlmrelayx.py Target, Event ID 4624 (type 3, NTLM) Workstation name does not match the source address

Detecting Impacket activity, or failing to, is itself a finding. If these scripts ran across your domain and nothing alerted, your detection has a gap as important as any vulnerability.

How we use it in an engagement

Impacket is a core toolkit of the post-exploitation and lateral-movement phases in internal network penetration testing and red team assessments. It works alongside tools like NetExec (which itself uses Impacket under the hood) to turn a foothold into domain-wide compromise, one protocol abuse at a time. BloodHound maps which paths are worth taking; Impacket is how each step is carried out.

We use it inside the written rules of engagement, starting from the standard user account agreed at scoping, and we stop at any boundary you set, documenting the path we would have taken. In the report, each technique that worked becomes a finding with its proof of concept and the fix, and the detection signals above tell your team what should have alerted while it ran. Tiers and what each includes are on the internal network penetration testing cost page.

Frequently asked questions

Does Impacket run on Windows? Yes. It is written in Python, so it runs on Windows, Linux and macOS. Most testers run it from Linux. The targets are Windows either way, and nothing is installed on them.

Is Impacket malware, and why does antivirus flag it? No. It is an open-source library maintained by Fortra. Antivirus flags it because attackers use the same scripts, so a copy on a machine that is not a tester’s is worth an alert.

What is the difference between Impacket and NetExec? Impacket is the protocol library and a set of single-purpose scripts. NetExec is built on top of it and runs the same kinds of checks across many hosts at once. For an interactive shell over WinRM instead of SMB or WMI, testers use Evil-WinRM.

Is Impacket legal to use? The software is legal to download and use. Running it against systems without written authorization is not; on a penetration test the signed scope is that authorization.

The short version

Impacket is the toolkit that abuses Windows network protocols at a low level, delivered as named scripts: secretsdump, psexec, GetUserSPNs, ntlmrelayx, each automating a specific Active Directory attack. When one appears in a report, it names the exact technique used and the exact weakness behind it: dumpable credentials, weak service-account passwords, missing SMB signing, excessive rights. The fixes are the fundamentals of AD security, and whether your monitoring caught any of it is a finding in its own right.

Want to know how far these techniques would get inside your Active Directory, and whether anything would notice? That is what an internal penetration test measures, and our Active Directory pentesting service focuses on the directory alone, from $6,000. Scope one here.

Mark Kiss

Written by

Mark Kiss, Founder & CEO

15+ years in the field. Focus: Offensive security & strategy. Part of the team that scopes, tests, and reports for our clients. Full profile →

All articlesRed Teaming

Find out what an attacker sees.

Tell us what to test and see your fixed price.

Prefer the full scoping questionnaire? 
Start the conversation

Get a quick proposal

We are online