Capstone: Hardened and Real-World Kernels


Kernel Exploitation: A CTF Study Path.

The final module puts everything together against the defences that modern kernels actually ship: function-granular KASLR, kernel control-flow integrity, panic_on_warn and page allocator shuffling. It also leaves custom drivers behind for stock kernel subsystems and for leaks that come from the CPU itself.

What you will learn

  • FG-KASLR: what stays at a fixed offset and how __ksymtab helps
  • Living with kCFI: data-only arbitrary calls and type-compatible targets
  • Microarchitectural KASLR breaks (prefetch timing, EntryBleed) and their limits under emulation
  • Exploiting stock subsystems (netfilter / nf_tables over netlink)
  • Abusing the module loader and ELF relocations

Prerequisites

All previous modules.

References



Challenges

hxp CTF 2020 · difficulty ★★★★☆ · module: Capstone: Hardened and Real-World Kernels

A textbook kernel stack bug, except function-granular KASLR moves most gadgets around: work out what stays put.

Mitigations: SMEP, SMAP, KPTI (kernel default; depends on the host CPU), KASLR, FG-KASLR

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /exploit. The flag is the raw disk /dev/sda (root only).

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): initramfs.cpio.gz, run.sh, vmlinuz.

Original challenge

Description

Security is difficult, and defenses should be always taken with a grain of salt.

Who would win? A buffer overflow or The Hottest Linux Defenses?

Flag is in /dev/sda.

Note: Increased time limits around 2020-12-20 01:00 UTC due to popular request. Nothing else changed.

Points

769

Solves

4

Credits

  • Challenge author(s): sisu, for hxp CTF 2020
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

corCTF 2025 · difficulty ★★★★☆ · module: Capstone: Hardened and Real-World Kernels

You get a syscall that crashes the kernel; turn crashes and timing into information. Needs a real CPU (KVM).

Mitigations: KASLR, KPTI disabled (pti=off), oops=panic, -cpu host

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /exploit. The original uses -cpu host (KVM); without KVM the max CPU model is used. The original ran on an AMD EPYC 7502P (Zen 2); the intended timing side channel may behave differently on other CPUs. Memory is 1 GiB here (the original used 2 GiB).

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, config, diff.diff, initramfs.cpio.gz, run.sh.

Original challenge

Description

amd vibes only 🔥 called corctf\_crash kernel folded under zero pressure 🗿 zenerational aura loss 💀 couldnt rizz up ring3 🥀 gotta farm that zenerational aura wealth to root ✨

Note that the kernel is built with the config below at commit of: 8742b2d8935f

The challenge is hosted on an EPYC 7502P (Zen 2 generation).

The vmlinux with symbols can be downloaded at: https://static.cor.team/2025/zen/vmlinux.gz

Connect to remote and upload your exploit with: ssh [email protected] connect $(cat exploit | ssh i-heart-pwn.ctfi.ng upload)

Points

340

Solves

5

Credits

  • Challenge author(s): FizzBuzz101, for corCTF 2025
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

idekCTF 2024 · difficulty ★★★★★ · module: Capstone: Hardened and Real-World Kernels

The kernel will try to load your module, but it is tiny and must survive the loader's checks.

Mitigations: SMEP, SMAP, KASLR (kernel default), oops=panic, payload delivered as raw drive, < 64 KiB

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put your payload at /home/hacker/exploit first; it is attached to the VM as a raw disk, as in the original challenge. /init copies it to /bin/pwn at boot. The kernel .config is shipped as config. The handout's initramfs also held a prebuilt /bin/pwn left over from the author's tooling; it is removed here (/init writes yours there anyway).

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, config, initramfs.cpio.gz, module/Makefile, module/load.c, module/load.ko, run.sh.

Original challenge

Description

kernel + elf golfing.

https://tmpout.sh/3/19.html

Note: There's a $50 USD author bounty on this challenge first blood.

HINT: You should look more closely at kernel relocations, and it is possible to make a kernel module in 345 bytes.


Points

500

Solves

1

Credits

  • Challenge author(s): unvariant , for idekCTF 2024
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

TeamItaly CTF 2023 · difficulty ★★★★★ · module: Capstone: Hardened and Real-World Kernels

A message store with both a leak and a UAF, on a kernel where forward-edge CFI blocks the usual hijacks.

Mitigations: SMEP, SMAP, KPTI, KASLR (kernel default), kCFI, page_alloc.shuffle=1, panic_on_warn=1, oops=panic

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /jail/exploit. You start inside an nsjail (only /jail is writable); your exploit is at /jail/exploit. The flag is the raw disk /dev/sda (root only).

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, kernel.config, rootfs.cpio.gz, run.sh, src/secmsg.c, src/secmsg.h.

Original challenge

Description

I implemented a Secure Message Storage in the Kernel, can you please take a look at it?

This is a remote challenge, you can connect with:

Points

500

Solves

0

Credits

  • Challenge author(s): @Bonfee, for TeamItaly CTF 2023
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

SCTF 2023 · difficulty ★★★★★ · module: Capstone: Hardened and Real-World Kernels

You control the kernel stack pointer but know nothing about where anything is; the CPU itself has to tell you.

Mitigations: SMEP, SMAP, KASLR, KPTI (kernel default; depends on the host CPU), requires KVM + -cpu host (side channel unreliable under TCG)

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /exploit. The original uses KVM with -cpu host. Without KVM the max CPU model is used, and timing side channels may not behave like on real hardware. The VM powers off 150 seconds after boot.

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, rootfs.cpio, start.sh.

Original challenge

Description

只是站在了巨人的肩膀上

Just standing on the shoulders of giants.


附件:链接:https://pan.baidu.com/s/1rcbuzEBIT7Ick0kR4ugfXw?pwd=SCTF
提取码:SCTF
Google Drive:https://drive.google.com/file/d/1frVoalJovloloUHPiW339M5mjKItvSKG/view?usp=sharing

Points

952

Solves

2

Credits

  • Challenge author(s): pray77, for SCTF 2023
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

WMCTF 2022 · difficulty ★★★★★ · module: Capstone: Hardened and Real-World Kernels

No custom driver here: the bug lives in a stock subsystem of a distro kernel, reached through netfilter.

Mitigations: SMEP, SMAP, no KASLR (nokaslr), KPTI (kernel default; depends on the host CPU)

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. Put a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /exploit.

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, rootfs.img, start.sh.

Original challenge

Description

Get ROOT!
Attachment:
China : https://pan.baidu.com/s/1xVtXoLVrPeVXINuB_WaqNQ 提取码: kapu
Other regions:https://drive.google.com/file/d/1jlGlR4tY_eVGIKj7jv84FxdcOQnkrL56/view?usp=sharing

Hint
cve-2022-1972

Points

500

Solves

0

Credits

  • Challenge author(s): not recorded (credit goes to the WMCTF 2022 organizers)
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

Azure Assassin Alliance CTF 2022 · difficulty ★★★★★ · module: Capstone: Hardened and Real-World Kernels

There is no shell: the console runs a packet parser as an unprivileged user. Exploit it first, then the crypto driver behind it. No public writeup, so the kernel technique is up to you.

Mitigations: SMEP, SMAP, KPTI (kernel default; depends on the host CPU), KASLR

Running it

Run /challenge/run. It boots the original kernel and root filesystem in QEMU with the serial console on your terminal. Quit with Ctrl-A then X. /home/hacker/exploit is not copied into this VM. The console runs the userland /parser program (ENTER YOUR PACKET >), not a shell; you reach kkk.ko through it. The VM powers off 600 seconds after boot.

The flag is put where the original challenge kept it, readable only by root in the VM (unless a note above says otherwise). Files in /challenge (kernel, initramfs, sources and the original launcher, where the CTF shipped them): bzImage, rootfs.img, start.sh.

Original challenge

Description

Yet another signin (kernel) pwn challenge

Points

869

Solves

4

Credits

  • Challenge author(s): not recorded (credit goes to the Azure Assassin Alliance CTF 2022 organizers)
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

30-Day Scoreboard:

This scoreboard reflects solves for challenges in this module after the module launched in this dojo.

Rank Hacker Badges Score