CTF Practice Guide
CTF Strategy by Category
Web Exploitation
Key techniques:
- SQL injection (union, boolean blind, time-based)
- XSS (reflected, stored, DOM-based)
- SSRF (internal port scan, metadata access)
- LFI/RFI (log poisoning, PHP wrappers)
- IDOR (object reference manipulation)
- Business logic flaws
Tools: Burp Suite, SQLMap, ffuf, Gobuster, Nikto
Practice platforms:
- DVWA — self-hosted, various difficulty levels
- Juice Shop — self-hosted, modern web vulns
- WebGoat — guided learning
- PortSwigger Academy — free, excellent tutorials
PWN / Binary Exploitation
Key techniques:
- Buffer overflow (stack, heap)
- ROP (Return-Oriented Programming)
- Format string vulnerabilities
- Integer overflow
- Use-after-free
Tools: GDB (pwndbg/GEF), pwntools, ROPGadget, ropper, one_gadget
Practice:
bash
# pwntools template
from pwn import *
context.update(arch='i386', os='linux')
# Your exploit codePractice platforms:
- VulnHub pwn challenges — search for "pwn" or "exploit"
- Rop Emporium — excellent ROP tutorial series
- Binjabo — challenges by pwnable.kr
- Pwnable.kr — classic pwn challenges
Cryptography
Key techniques:
- Base64/32/16 encoding
- XOR cipher (with known/unknown key)
- RSA attacks (small e, padding oracle, weak keys)
- AES ECB pattern recognition
- Hash length extension
Tools: CyberChef, hashcat, John the Ripper, openssl, rsatool
Practice:
bash
# CyberChef recipes to know:
# - From Base64
# - XOR with key
# - Decrypt AES ECB
# - Hash identificationForensics
Key techniques:
- File carving (binwalk, foremost)
- Memory dump analysis (Volatility)
- PCAP analysis (Wireshark, tcpdump)
- Steganography (zsteg, steghide)
- Log analysis
Tools: Volatility, binwalk, foremost, strings, hexedit, Wireshark
Practice:
bash
# File type detection
file challenge
binwalk challenge
xxd challenge | head
# Carve files
binwalk -e challenge
foremost -i challenge -o output
# Memory analysis (Volatility 3)
python3 vol.py -f memory.dmp windows.info
python3 vol.py -f memory.dmp windows.pslist
python3 vol.py -f memory.dmp windows.malfindOSINT
Key techniques:
- Google dorking
- WHOIS lookup
- DNS enumeration
- Metadata extraction
- Social media investigation
- Breach database search
Tools: theHarvester, Maltego, SpiderFoot, exiftool
Practice:
bash
# Google dorking examples
site:example.com filetype:pdf
site:example.com "internal"
inurl:admin login
# WHOIS
whois domain.com
# Metadata
exiftool document.pdfPrivilege Escalation
Linux:
- SUID/SGID exploitation (GTFOBins)
- Sudo misconfigurations
- Kernel exploits
- Cron job abuse
- NFS misconfigurations
- Docker group membership
Windows:
- Token impersonation (SeImpersonatePrivilege)
- Service misconfigurations
- AlwaysInstallElevated
- Registry autorun
- DLL hijacking
- Kernel exploits
Tools: linpeas, winpeas, pspy, accesschk, PowerUp
Practice:
bash
# Linux privesc checklist
find / -perm -4000 2>/dev/null
sudo -l
cat /etc/crontab
groups
docker run -v /:/mnt alpine chroot /mnt sh
# Windows privesc checklist
whoami /priv
whoami /all
net user
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunPlatform-Specific Strategies
HackTheBox
Starting out:
- Start with "Starting Point" machines (free)
- Connect via OpenVPN
- Follow along with friendly walkthroughs initially
Getting better:
- Attempt machine for 1-2 hours
- If stuck, read hints (not full walkthrough)
- Try again
- If really stuck, read writeup but don't just copy — understand
Advanced:
- Time yourself (2 hours to root)
- Root without metasploit (optional challenge)
- Do Hard/Insane boxes
TryHackMe
Learning path:
- Complete Beginner → Jr. Penetration Tester → Offensive Pentesting
- Do rooms in order (they build on each other)
- Use PwnedHelper if truly stuck (after trying)
Certification prep rooms:
- OSCP path
- eJPT path
- CEH path
Proving Grounds
Why PG over HTB for OSCP:
- More similar difficulty to actual exam
- Some machines are exact recreations
- Less "trick" machines
- Focus on fundamentals
Strategy:
- Do easy machines first
- Medium Linux, then medium Windows
- Attempt Hard when ready
- Practice buffer overflow (pg-pwn series)
Common CTF Patterns
When stuck on Web
bash
# 1. Check for hidden parameters
ffuf -w wordlist.txt -u http://target/?FUZZ=value
# 2. Check source code
view-source: or Ctrl+U
# 3. Check cookies
document.cookie in browser console
# 4. Try common injection points
' " ; -- admin' OR '1'='1
# 5. Check for backup files
index.php.bak, config.php~, .git/backupWhen stuck on PrivEsc
bash
# Linux:
# 1. Run linpeas.sh
# 2. Check SUID (GTFOBins)
# 3. Check sudo -l
# 4. Check cron
# 5. Check /etc/exports (NFS)
# Windows:
# 1. Run winpeas.bat
# 2. Check SeImpersonatePrivilege (printspoofer)
# 3. Check services (accesschk)
# 4. Check AlwaysInstallElevated
# 5. Check registry autorunsWhen stuck on PWN
bash
# 1. Understand the binary
checksec binary
rabin2 -i binary
rabin2 -R binary (relocations)
# 2. Find offset
cyclic 100
cyclic -l aaaa (crash address)
# 3. Find gadgets
ROPgadget --binary binary
ropper --file binary
# 4. If format string
%08x %n (write arbitrary)
%<num>$s (leak stack)Flag Patterns
# Common flag formats:
flag{...}
CTF{...}
p_ctf{...}
THC{...}
pragyan{...}bash
# Search for flags in files
strings file | grep -i flag
grep -r "flag{" .
find . -name "*.txt" -exec grep -l "flag" {} \;
# In PCAP files
tshark -r capture.pcap -Y "http" -T fields -e http.file_data | grep flagRecommended Practice Schedule
Daily: 1 HTB machine OR 1 THM room (1-2 hours)
Weekly: 1 CTF (3-5 hours)
Monthly: 1 certification exam attempt OR PG session
Weekly focus:
- Mon: Recon/web
- Tue: PrivEsc
- Wed: Crypto/forensics
- Thu: Network/web
- Fri: Pwn (if preparing for OSCP)Key Takeaways
- Struggle before looking at solutions — you learn more from failing and trying again
- Take notes — document what you tried, what worked, why
- Read writeups — even after solving, read how others approached it
- Focus on fundamentals — basic skills beat fancy techniques
- Practice consistently — 1 hour daily beats 7 hours on weekends