A beginner's guide to CTF competitions - the gamified way to learn cybersecurity.
Capture The Flag (CTF) competitions are cybersecurity challenges where you solve puzzles to find hidden "flags" - typically strings like flag{y0u_f0und_1t!}.
- 🎯 Learn security concepts hands-on
- 🏆 Build demonstrable skills
- 👥 Join a community
- 📝 Great for resume/portfolio
- 💰 Win prizes (sometimes significant)
Choose challenges from categories, earn points for each flag found.
| Category | What You'll Learn |
|---|---|
| Web | SQL injection, XSS, authentication bypasses |
| Crypto | Encryption/decryption, cipher attacks |
| Pwn/Binary | Buffer overflows, exploitation |
| Reverse Engineering | Disassembly, malware analysis |
| Forensics | File analysis, memory dumps, logs |
| Misc | Programming, OSINT, trivia |
| Steganography | Hidden data in images/files |
Teams defend their own servers while attacking others.
Compete to maintain control of a system.
Minimum Setup:
- Linux VM (Kali or Parrot)
- Web browser with developer tools
- Text editor (VS Code, Sublime)
Install Essential Tools:
# Core tools
sudo apt install -y \
python3 python3-pip \
netcat-traditional \
nmap \
john \
hashcat \
binwalk \
steghide \
exiftool \
ghidra \
gdb
# Python libraries
pip3 install pwntools requests beautifulsoup4 pycryptodome| Platform | Difficulty | Best For |
|---|---|---|
| PicoCTF | ⭐ Easy | Absolute beginners |
| OverTheWire | ⭐⭐ | Linux/scripting |
| TryHackMe CTF Rooms | ⭐⭐ | Guided examples |
| CryptoHack | ⭐⭐ | Cryptography |
| pwn.college | ⭐⭐⭐ | Binary exploitation |
| HackTheBox Challenges | ⭐⭐⭐ | All categories |
Beginner-Friendly CTFs:
- PicoCTF (annual, free, beginner)
- NahamCon CTF
- DiceCTF
- San Diego CTF (SDCTF)
Find Competitions:
- CTFtime.org - CTF calendar and rankings
Common Vulnerabilities:
- SQL Injection
- Cross-Site Scripting (XSS)
- Server-Side Template Injection (SSTI)
- Local/Remote File Inclusion (LFI/RFI)
- Authentication bypasses
- IDOR (Insecure Direct Object Reference)
Tools:
| Tool | Purpose |
|---|---|
| Burp Suite | HTTP proxy and manipulation |
| Browser DevTools | Inspect source, network, storage |
| SQLMap | Automated SQL injection |
| curl | HTTP requests from command line |
Learning Path:
- Complete PortSwigger Web Security Academy
- Solve OWASP WebGoat
- Practice on TryHackMe Web rooms
Common Topics:
- Classical ciphers (Caesar, Vigenère, substitution)
- RSA attacks (small e, common modulus)
- AES/block cipher attacks
- Hash cracking
- XOR operations
Tools:
| Tool | Purpose |
|---|---|
| CyberChef | Data transformation swiss army knife |
| dCode | Cipher identification and cracking |
| RsaCtfTool | RSA attacks |
| Python + pycryptodome | Custom scripts |
Learning Path:
- Complete CryptoHack
- Khan Academy cryptography
- "Crypto 101" PDF
Common Techniques:
- Buffer overflows
- Return-oriented programming (ROP)
- Format string attacks
- Heap exploitation
- Shellcode writing
Tools:
| Tool | Purpose |
|---|---|
| gdb + pwndbg/gef | Debugging |
| pwntools | Exploit development |
| Ghidra/IDA | Disassembly |
| checksec | Binary protections |
| ROPgadget | ROP chain building |
Learning Path:
What You'll Analyze:
- ELF binaries (Linux)
- PE files (Windows)
- Android APKs
- Obfuscated code
Tools:
| Tool | Purpose |
|---|---|
| Ghidra | Free disassembler/decompiler |
| IDA Free | Industry standard |
| radare2/Cutter | Open source framework |
| strings | Quick string extraction |
| ltrace/strace | Runtime tracing |
Learning Path:
- Reverse simple crackmes
- challenges.re
- crackmes.one
Common Tasks:
- File carving and recovery
- Memory analysis
- Network packet analysis
- Steganography detection
- Log analysis
Tools:
| Tool | Purpose |
|---|---|
| binwalk | Firmware/file extraction |
| Volatility | Memory forensics |
| Wireshark | Packet analysis |
| Autopsy | Disk forensics |
| exiftool | Metadata extraction |
| steghide | Steganography |
Learning Path:
- DFIR Diva challenges
- CTF forensics challenges
- MemLabs
# Strings from binary
strings -n 8 challenge | grep -i flag
# File type identification
file mystery_file
# Hex dump
xxd file | head -50
# Extract hidden files
binwalk --extract file
# Check image for hidden data
steghide extract -sf image.jpg
exiftool image.jpg
zsteg image.png # PNG specific
# Base64 decode
echo "ZmxhZ3t0ZXN0fQ==" | base64 -d
# Hex to ASCII
echo "666c6167" | xxd -r -p
# Quick web requests
curl -s http://target/page
curl -X POST -d "param=value" http://target
# Netcat connection
nc target 1337# XOR with single byte
bytes([b ^ 0x42 for b in data])
# Frequency analysis
from collections import Counter
Counter(ciphertext)
# Quick socket connection
from pwn import *
r = remote('host', 1234)
r.sendline(b'payload')
print(r.recv())- Read challenges carefully - The description often contains hints
- Check the easy ones first - Low-point challenges build confidence
- Take notes - Document what you try
- Collaborate - Teams win CTFs, not individuals
- Use hints wisely - Usually worth the point deduction if you're stuck
- Don't rabbit hole - Timebox challenges, move on if stuck
- Source code comments often contain hints
robots.txtand.gitdirectories on web challenges- Default credentials (admin:admin, root:toor)
- Encoded data is usually base64, hex, or rot13
- If something looks like random text, try frequency analysis
- Check file magic bytes if file extension seems wrong
- Complete PicoCTF (all years)
- Finish OverTheWire Bandit, Natas, Narnia
- Join 3-5 online CTFs
- Read write-ups after each competition
- Specialize in 1-2 categories
- Join a team or create one
- Compete regularly (1-2 per month)
- Write and publish your own write-ups
- CTFtime Teams
- Discord servers (TryHackMe, HackTheBox)
- University clubs
- Local security meetups
After each CTF, read write-ups for challenges you couldn't solve:
- CTFtime Write-ups
- Team blogs
- YouTube walkthrough videos
Writing your own improves retention:
- Document challenge description
- Explain your approach
- Include code/commands used
- Screenshot key steps
- Reflect on what you learned
| Resource | Description |
|---|---|
| CTFtime | Competition calendar, rankings |
| Trail of Bits CTF Guide | Comprehensive guide |
| CTF101 | Category guides |
| John Hammond YouTube | CTF walkthroughs |
| LiveOverflow | In-depth explanations |
| IppSec | HackTheBox walkthroughs |