Bit Flips, Page Tables and x86 Privilege Machinery


Kernel Exploitation: A CTF Study Path.

Some challenges give you almost nothing: one bit, one byte, one register. The way forward is the hardware: page-table entries, CR3, descriptor tables, call gates, interrupt frames, and occasionally the emulator around the guest. Learn how x86 enforces privilege so you can find the one spot where a tiny write wins.

What you will learn

  • x86-64 paging: PTE permission bits, the physmap, CR3 and address-space switching
  • Segmentation still matters: LDT entries, call gates and modify_ldt
  • Interrupt and IRET frames, ring transitions
  • Choosing the single bit/byte to corrupt (task flags, page tables)
  • Thinking outside the guest kernel: QEMU configuration and emulation bugs

Prerequisites

Modules 01-03; read the Intel SDM chapters on paging and protection.

References



Challenges

smileyCTF 2025 · difficulty ★★☆☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

You may write a single zero byte anywhere, even somewhere that is supposed to be read-only.

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

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, initramfs.cpio.gz, run.sh.

Original challenge

Description

blargh

Points

216

Solves

38

Credits

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

Midnight Sun CTF 2021 Quals · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

You may flip exactly one bit of kernel memory. Choose it well.

Mitigations: nokaslr, no SMEP/SMAP (default 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): initrd, kernel, run.sh.

Original challenge

Description

A *bit* of a sequel. This time you really only get one flip, make it count.
settings Service: 

Points

228

Solves

18

Credits

  • Challenge author(s): 0xb0bb, for Midnight Sun CTF 2021 Quals
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

Circle City Con CTF 2021 · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

A single bit flip inside your own task_struct, behind a seccomp sandbox; decide which flag matters.

Mitigations: nokaslr, no SMEP/SMAP (default CPU), seccomp sandbox

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 shell runs inside a seccomp sandbox and its prompt is not a plain $ . The original also shipped a 52 MB uClibc buildroot toolchain for building exploits; it is not included (a static musl or glibc binary works too).

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, initramfs.cpio.gz, launch.sh, src/backdoor.c, src/sandbox.c.

Original challenge

Description

Somebody added a suspicious syscall to my kernel...
No problem! I blocked it with seccomp and now nobody can use it ;)

Note: You can use the attached SDK to compile your exploit

Points

299

Solves

3

Credits

  • Challenge author(s): qxxxb, for Circle City Con CTF 2021
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

cr3 CTF 2024 · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

The driver lets you load CR3 with whatever you want; learn how x86 address spaces really work.

Mitigations: SMEP, SMAP, KASLR, KPTI (kernel default; depends on the host CPU), 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 /exploit. The flag lives in the memory of the root process /cocay, not in a file you can read. Its original 56-byte slot (0x498008) is too small for a pwn.college flag, so in this dojo /cocay is cocay.dojo.gz (decompressed at boot): the same binary with its FLAG pointer moved to 0x497f80, where the flag is written at boot (a hint is left in the old slot). /flag (root only) also holds it.

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, cocay.dojo.gz, rootfs.cpio, run.sh.

Original challenge

Description

I want to steal the message my friend cocay has. Can u help me with that?

$ 

Points

404

Solves

10

Credits

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

BITSCTF 2026 · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

You just got promoted, in the x86 privilege-ring sense; think about what ring 0 can do without the usual kernel APIs.

Mitigations: KASLR, KPTI, no SMEP/SMAP (kvm64)

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): bzImage, diff.txt, rootfs.cpio.gz, run.sh.

Original challenge

Description

You just got promoted by your boss! What's the first thing you're doing?

Points

94

Solves

Unknown

Credits

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

DEF CON CTF Qualifier 2026 · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

The bug is not where you expect it; sometimes the machine itself is the vulnerable component.

Mitigations: SMEP, SMAP, KASLR, SMP 2

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 /init hardcodes two fake flags (one handed to the FUSE daemon, one in /root/flag2). Here /init is init.dojo, which feeds your one real flag to both places; either way of getting it counts.

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, init.dojo, rootfs.cpio.gz, run.sh.

Original challenge

Description

You can never escape time.

Note: the maximum submission size after base64 decoding is 2 MiB.

Points

Flag1: 65 Flag2: 303

Solves

Flag1: 43 Flag2: 30

Credits

  • Challenge author(s): allee, for DEF CON CTF Qualifier 2026
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

MaltaCTF 2025 Quals · difficulty ★★★☆☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

A new syscall writes the flag somewhere in memory for you; the hard part is reading it back without any leak.

Mitigations: SMEP, SMAP, KASLR, KPTI

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. Log in on the console as ctf with password ctf.

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.gz, run.sh, vmlinux.gz.

Original challenge

Description

I hear toasterpwn added a new syscall to the linux kernel, just for you to get the flag. The creds are ctf:ctf. Good luck without a leak!

Points

272

Solves

16

Credits

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

zer0pts CTF 2023 · difficulty ★★★★☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

You get exactly one bit flip just past a heap object; choose the neighbor and the bit wisely.

Mitigations: SMEP, SMAP, KASLR, panic_on_warn

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 root filesystem is an ext2 disk, so there is no initramfs to add files to: transfer your exploit over the console (for example base64). The flag is /flag. Disk changes are discarded when the VM stops.

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.ext2, src/flipper.c, start-qemu.sh.

Original challenge

Description

Get some flippers to swim in Linux kernel heap

Points

364

Solves

5

Credits

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

KalmarCTF 2024 · difficulty ★★★★☆ · module: Bit Flips, Page Tables and x86 Privilege Machinery

Model-specific registers are exposed to userland; find out how much of the CPU's syscall path you can reshape.

Mitigations: SMEP, SMAP, KASLR, KPTI

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. Model-specific registers behave differently under KVM and under TCG emulation (no /dev/kvm), so an exploit tuned on one may not work on the other.

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, initramfs.cpio.gz, msr.diff, run.sh.

Original challenge

Description

I hate having to use sudo every time I want to change the MSRs. Let's just make it global writable! I'm sure that won't cause any security issues...

Points

490

Solves

9

Credits

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

SCTF 2023 · difficulty ★★★★★ · module: Bit Flips, Page Tables and x86 Privilege Machinery

A single byte, anywhere you like; make it count by aiming below the virtual memory abstraction.

Mitigations: SMEP, SMAP, KASLR, KPTI (kernel default; depends on the host CPU), 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 /exploit. The VM powers off 120 seconds after boot, as in the original.

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

开局一个碗,一步步征服世界
Start with a bowl and conquer the world step by step.
附件:链接:https://pan.baidu.com/s/1pndjQNdAjXlmRV7lL_Og1A?pwd=SCTF
提取码:SCTF
Google Drive:https://drive.google.com/file/d/1-LwDyLKxj-lLju73dRrrE9eUEgHqTAr3/view?usp=sharing

Challenges Hints:
sycrop的flag内容为预期解,也是sycrpg的线索 The flag content of sycrop is the expected solution, which is also the clue of sycrpg.

Points

1000

Solves

1

Credits

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

hxp CTF 2022 · difficulty ★★★★★ · module: Bit Flips, Page Tables and x86 Privilege Machinery

Exactly one byte, written once; find x86 machinery that turns that into a door to ring 0.

Mitigations: SMAP, no SMEP, KPTI, KASLR (kernel default), 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 /exploit. The flag is the raw disk /dev/vda (root only). The guest asks the terminal for its size at login; the web terminal answers it. A scripted session must reply to ESC[6n (e.g. ESC[24;80R). -svm was added to the CPU model so it boots under KVM on Intel hosts.

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, one_byte.c, run.sh, vmlinuz.

Original challenge

Description

Last time, you got ten bytes. This time, you only get one. What you also get is the most recent Debian Bullseye kernel (linux-image-5.10.0-21-amd64/stable-security).

Points

714

Solves

5

Credits

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

TRX CTF 2025 · difficulty ★★★★★ · module: Bit Flips, Page Tables and x86 Privilege Machinery

A tiny driver that does one thing: write any MSR. Very hard, and the bug is not the hard part.

Mitigations: SMEP, SMAP, KPTI, KASLR, panic_on_warn=1, page_alloc.shuffle=1, CONFIG_HZ=100

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. You start inside an nsjail as uid 1000; /flag is outside the jail. /etc/init.d/rcS copies it to /jail/exploit (padded with zeros to whole 512-byte sectors).

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, driver.c, initramfs.cpio.gz, kernel.config, run.sh.

Original challenge

Description

im a baby and im small

DISCLAIMER: This challenge was rated "insane" from the pwners of the team, please reconsider approaching the challenge DISCLAIMER: Please test your solve locally before spawning a remote instance of the challenge!

NOTE: In order to make the intended exploit more reliable CONFIG_HZ is set to 100

Points

500

Solves

0

Credits

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

TRX CTF 2026 · difficulty ★★★★★ · module: Bit Flips, Page Tables and x86 Privilege Machinery

The sequel to the smallest driver; per-CPU state and the syscall entry path are the playground. Very hard.

Mitigations: SMEP, SMAP, KASLR, KPTI, FSGSBASE, oops=panic, panic_on_warn=1, page_alloc.shuffle=1

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 /exploit (padded with zeros to whole 512-byte sectors).

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, driver.c, initramfs.cpio, run.sh.

Original challenge

Description

im a baby and im the smallest pt.2

DISCLAIMER: difficulty "insane"

NOTE: fsgsbase is enabled + check out the setup, you need to exploit the driver three times in a row in order to get the flag

Points

500

Solves

1

Credits

  • Challenge author(s): leave, for TRX CTF 2026
  • 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