Kernel Exploitation: A CTF Study Path.
Real kernel-exploitation CTF challenges from 2020-2026, grouped by technique and ordered as a study path from ring-0 basics to hardened, page-level exploitation.
Every challenge boots its original kernel and root filesystem in QEMU: start it and run /challenge/run. For most challenges, put your statically linked exploit at /home/hacker/exploit first and it is copied into the VM (each challenge page says where, or how to get it in when it cannot be). The flag sits where the original challenge kept it, readable only by root inside the VM. Quit QEMU with Ctrl-A then X.
Work through the modules in order (11 and 12 are side branches you can take any time after module 03). Inside a module, challenges go from easiest to hardest. A challenge that also relies on techniques from a later module says so on its page.
The challenges come from mito753/Kernel-Exploit-Dojo, mito753's compilation of kernel CTF challenges sorted by technique. mito753 compiled them; the challenges belong to their original authors, whom each challenge page credits along with its CTF.
Working on the challenges
On pwn.college
- Start a challenge, then use the Terminal or Workspace (VS Code) tab, or SSH in after adding a public key in your settings:
ssh -i key [email protected]. Each start gives you a fresh container, but/home/hackeris kept, so keep exploits and notes there. - Copy files with
scp/sftpover the same connection (scp -i key exploit [email protected]:~/exploit), or edit them in the Workspace. - Build exploits statically with the image's compiler:
/usr/bin/gcc -static -O2 -o ~/exploit exploit.c. - Put the binary at
/home/hacker/exploit, run/challenge/runand start it inside the VM (the challenge page says where it appears). Quit withCtrl-AthenX. - Practice mode (the lock icon) gives you
sudobut replaces/flagwith a practice flag. You do not need it for anything below.
Debugging on pwn.college
/challenge/run has no gdb stub on purpose. Debug a private copy instead. The workspace has qemu-system-x86_64, gdb (with pwndbg, gef and bata24-gef), cpio and gcc, and none of this needs root:
mkdir -p ~/dbg && cd ~/dbg && cp -r /challenge/. . # kernel, initramfs, original launcher, boot.json
python3 -c 'import json,shlex; print(shlex.join(json.load(open("boot.json"))["argv"]))' # the QEMU arguments run uses
echo exploit | cpio -o -H newc -R 0:0 > add.cpio # with your static ./exploit in this directory
cp <initramfs> debug.cpio && truncate -s %4 debug.cpio && cat add.cpio >> debug.cpio # append it, as run does
qemu-system-x86_64 <the arguments, with @INITRD replaced by debug.cpio> -nographic -s # -S: stop at the first instruction
Then, in a second terminal, attach with gdb -ex 'target remote :1234' vmlinux (gunzip vmlinux.gz first if the challenge ships one; without symbols, bata24-gef's kbase and ksymaddr-remote find them). While you debug, add nokaslr to -append, and give yourself a root shell by editing init in an extracted copy of the initramfs (for example setsid cttyhack setuidgid 0 sh) so you can read /proc/kallsyms and /proc/slabinfo. A few challenges use other placeholders: @FLAG is a file holding a test flag padded to 512 bytes, @ROOTFS a writable copy of the disk image named in boot.json (gunzip it if it is .gz), @BLANK an empty file of blank.size bytes, and @EXPLOIT your exploit padded to 512 bytes.
Running challenges locally
- Clone this dojo: each challenge directory is exactly what
/challengeholds. - Install
qemu-system-x86,gdb(with pwndbg, gef or bata24-gef),gccwith static glibc andcpio. Join thekvmgroup and add-enable-kvmfor full speed. - Use the recipe above, or the challenge's original launcher (
start.sh,run.sh, ...) with-sadded./challenge/runitself works only inside a pwn.college container.
Suggested workflow
- Read the challenge page, the driver source and the launcher; note the mitigations.
- Get a primitive working in a debug copy (locally or in
~/dbg) withnokaslr, a root shell and gdb attached. - Make it work under the original arguments (KASLR on, unprivileged user), and run it several times in a row if it races.
- Copy the final static binary to
/home/hacker/exploitand run/challenge/runin normal mode: the real flag only exists there.
A note on AI agents
Please do not use AI agents to solve these challenges. This dojo is practice for building your own kernel exploitation skills, and the challenges come from public CTFs whose writeups and exploits are very likely already in the agents' training data: an agent that solves one teaches you nothing.
If you really want AI help, use it as a tutor that asks you questions instead of handing you answers, for example with the socratic-tutor skill.
Problems or questions
For any concern or issue with this dojo (a challenge that does not boot, a wrong flag location, missing or wrong credits), please open an issue on GitHub.
Award: ⛩️
Stats
Modules
-
Ring 0 Basics: ret2usr
0 / 4 -
Kernel ROP, Pivots and the KPTI Trampoline
0 / 10 -
Arbitrary Read/Write: modprobe_path and Friends
0 / 17 -
Heap UAF: Reclaiming Freed Objects
0 / 13 -
SLUB Internals: Freelist Poisoning and Heap Overflows
0 / 7 -
Elastic Objects: msg_msg
0 / 4 -
pipe_buffer, Dirty Pipe and Page Cache Overwrites
0 / 15 -
Races: Double Fetch, userfaultfd and FUSE
0 / 14 -
Cross-Cache Attacks
0 / 8 -
Page-Level Primitives: Dirty Pagetable and Stale Mappings
1 Hacking
0 / 13 -
Bit Flips, Page Tables and x86 Privilege Machinery
0 / 13 -
eBPF, JITs and In-Kernel Interpreters
1 Hacking
0 / 11 -
Capstone: Hardened and Real-World Kernels
0 / 7
30-Day Scoreboard:
| Rank | Hacker | Badges | Score |