Skip to main content
CTFWorld
PwnDifficulty: Intermediate -> Elite

Binary Exploitation (Pwn)

Binary exploitation—commonly called Pwn—challenges you to turn low-level memory corruption bugs in C, C++, or Rust unsafe blocks into arbitrary code execution or shell access. Mastering Pwn gives you a deep, concrete understanding of CPUs, virtual memory, calling conventions, and modern exploit mitigations.

Core Attack Classes & Concepts

Stack Buffer Overflows & Shellcoding

Overwriting saved return addresses or local variables when unbounded reads hit stack buffers.

Key Techniques: Cyclic offset discovery, ret2win, executable stack shellcode injection, and stack alignment (16-byte RSP).

Return-Oriented Programming (ROP)

Chaining short instruction sequences ending in ret to bypass non-executable (NX) memory.

Key Techniques: ret2libc, GOT/PLT leaks to defeat ASLR, ret2csu, SROP (Sigreturn-Oriented Programming), and stack pivoting.

Format String Vulnerabilities

Passing user input directly as the format argument to printf-family functions.

Key Techniques: Arbitrary stack leaks (%p, %s), arbitrary writes (%n/%hn), and GOT overwrite when Partial RELRO is active.

Glibc Heap Exploitation

Abusing allocator metadata through use-after-free (UAF), double free, or heap overflow bugs.

Key Techniques: Tcache poisoning, fastbin dup, unsorted bin leaks, Safe-Linking mangling bypass, and House of Apple/FSOP.

Kernel & Sandbox Escapes

Exploiting Linux kernel drivers, eBPF verifiers, or seccomp-filtered userland jails.

Key Techniques: ret2usr / kROP, cred struct overwrite, dirty pagetable, and seccomp ORW (open/read/write) shellcode.

Competition Methodology Checklist

  1. 1

    Run file and checksec immediately to inventory architecture, PIE, NX, Stack Canary, and RELRO protections.

  2. 2

    Reconstruct memory layout in Ghidra/IDA while confirming runtime addresses inside GDB with pwndbg or GEF.

  3. 3

    Identify the exact primitive: info leak (defeat ASLR/PIE/Canary) first, then write primitive or control-flow hijack.

  4. 4

    Match the exact remote libc and loader using pwninit or Docker so offsets behave identically to the target server.

  5. 5

    Automate every interaction with pwntools scripts so exploit tweaks are reproducible in seconds.

Reference Pattern

Minimal pwntools Exploit Skeleton
python
from pwn import *

context.binary = elf = ELF('./vuln')
io = remote('target.ctfworld.local', 1337)

offset = 72
payload = flat(b'A' * offset, elf.sym['win'])
io.sendlineafter(b'Name: ', payload)
io.interactive()

Clean pwntools scripts separate offset calculation, gadgets, and I/O synchronization.

Recommended Practice Progression

Challenge / TrackPlatformLevelFocus
Program Misuse & Memory Errorspwn.collegeBeginnerStructured university-grade Linux & pwn curriculum
bof & collisionpwnable.krBeginnerClassic stack overflow and integer tricks
ROP Emporium (8 Challenges)ROP EmporiumIntermediateProgressive ROP chain mastery across architectures
how2heap PlaygroundShellphish GitHubAdvancedHands-on glibc heap exploitation techniques

Defensive Engineering Takeaway

Adopt memory-safe languages where feasible, compile native code with Full RELRO, PIE, Stack Canaries, CFI, and fortify-source, and deploy seccomp sandboxing plus continuous fuzzing (AFL++/libFuzzer).