Netexec
- https://www.netexec.wiki/getting-started/selecting-and-using-a-protocol
- Logs:
~/.nxc/logs/
- Logs:
- Cheatsheet: https://gist.github.com/strikoder/99635df00444bbf5fc90ca83ec8051a0
NOTES:
- by default,
netxecattempts to authenticate with passwords or hashes at the domain level… use--local-authto force local authentication, since sometimes passwords and usually hashes are different at these levels (Pwn3d!)for valid creds means an Administrator account
Netexec (formerly CrackMapExec) is a swiss army knife for pentesting networks that helps automate assessing the security of large networks in AD environments. Netexec uses secretsdump libraries under its hood, so it is the preferred tool for network enumeration (though secretsdump is still great for offline hash extraction or targeted actions)
Protocol Selection
Netexec supports multiple protocols. Check available services with:
Common protocols include:
mssql own stuff using MSSQLwinrm own stuff using WINRMldap own stuff using LDAPsmb own stuff using SMBssh own stuff using SSHvnc own stuff using VNCwmi own stuff using WMIftp own stuff using FTPrdp own stuff using RDP- And sometimes more…
Password Policy Enumeration
Enumerate password policy information via SMB:
User Enumeration
Enumerate Users
Enumerate Groups
Share Enumeration
Password Spraying
Password spraying uses one password against many users (alternates users), which has no risk of account lockout compared to brute-forcing. This is useful as a “hail Mary” to find any way in!
Best practice: Obtain account lockout policy beforehand (via enumeration or asking customer); if you don’t know the password policy, a good rule of thumb is to wait a few hours between attempts, which should be long enough for the account lockout threshold to reset.
Pass the Hash (PtH)
Netexec supports pass-the-hash attacks for lateral movement:
Credential Dumping
LSA Secrets
Remotely dump LSA secrets from a target:
SAM Database
Remotely dump SAM database secrets:
Active Directory Operations
NTDS Extraction
- https://www.netexec.wiki/smb-protocol/obtaining-credentials/dump-ntds.dit
- NOTE: this can sometimes crash the DC:
To dump one account instead of the full database, add --ntds --user <USER>:
LDAP Operations
Admin Count Enumeration
Find high-value users with adminCount=1 (includes Domain Admins, Enterprise Admins, Backup Operators, etc.):
Command Execution
Sudo is REQUIRED because these operations act as a server/listener.
--exec-method | Protocol | How | Noise | Port |
|---|---|---|---|---|
wmiexec (default) | WMI | WMI process create | Lower | 135 |
smbexec | SMB | Creates a Windows service | Medium | 445 |
atexec | SMB | Scheduled task | Lower | 445 |
mmcexec | DCOM | MMC20 DCOM object | Lowest | 135 |
Modules
| Module | Command | Purpose |
|---|---|---|
spider_plus | nxc smb <T> -M spider_plus | Crawl shares, index all files |
ntdsutil | nxc smb <T> -M ntdsutil | Safe NTDS dump from disk |
lsassy | nxc smb <T> -M lsassy | Remote LSASS dump + parse |
laps | nxc ldap <T> -M laps | Read LAPS passwords |
gpp_password | nxc smb <T> -M gpp_password | GPP cpassword decrypt |
ntds-dump-raw | nxc smb <T> -M ntds-dump-raw | Raw disk NTDS extraction |
nanodump | nxc smb <T> -M nanodump | Stealthier LSASS dump |
gpp_autologin | nxc smb <T> -M gpp_autologin | GPP autologon creds |
webdav | nxc smb <T> -M webdav | Check if WebDAV enabled |
petitpotam | nxc smb <T> -M petitpotam | Coerce NTLM auth |
nopac | nxc smb <T> -M nopac | Check noPac/sAMAccountName vuln |
zerologon | nxc smb <T> -M zerologon | Check Zerologon vuln |