pipe_buffer, Dirty Pipe and Page Cache Overwrites


Kernel Exploitation: A CTF Study Path.

Pipes are the Swiss army knife of modern kernel exploitation. struct pipe_buffer arrays live in a resizable kmalloc cache and hold a struct page *, flags and an ops pointer. Corrupt them and you can leak, hijack control flow, or (the Dirty Pipe idea) write into the page cache of files you can only read, such as /etc/passwd or a setuid binary.

What you will learn

  • pipe_buffer layout, fcntl(F_SETPIPE_SZ) to choose its cache, and splice() to attach file pages
  • PIPE_BUF_FLAG_CAN_MERGE and why it lets you write to read-only files (CVE-2022-0847)
  • Overwriting privileged files and binaries through the page cache
  • Other ways into the page cache: COW bypasses, missing FOLL_WRITE, uprobes
  • Getting a lot from a tiny primitive (decrement, few bytes) by choosing the right victim

Prerequisites

Module 04. Module 06 is useful for leaks.

References



Challenges

b01lers CTF 2026 · difficulty ★☆☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A kmalloc-1024 object is freed while still reachable; the most-solved intro to reclaiming freed kernel objects.

Mitigations: SMEP, SMAP, KASLR, KPTI, 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 /home/ctf/exploit. That is where the original's banner says it goes. The original /init writes a fake flag over /flag.txt at boot; init.dojo is the same script without that line.

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

Original challenge

Description

`This wall is not very solid seemingly, can you get through it?`

Points

367

Solves

69

Credits

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

HITCON CTF 2023 Quals · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

The kernel stage of a full-chain: one freed-twice buffer is all you get; make pipes do the rest.

Mitigations: SMEP, SMAP, KASLR (kernel default), 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. Booting takes about 20 seconds (FG-KASLR).

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): README.md, bios/bios-256k.bin, bios/efi-e1000.rom, bios/kvmvapic.bin, bios/linuxboot_dma.bin, bios/vgabios-stdvga.bin, bzImage, initramfs.cpio.gz, run.sh, src/rose.c.

Original challenge

Description

https://storage.googleapis.com/hitconctf2023/chal-wall-rose/wall-rose-a10160050459354487c14f76f6bbd783d8d02c91.tgz

Challenge

Instruction
You have a busybox shell running as user user
/home/user/rose.ko is a vulnerable kernel driver
Try exploiting /home/user/rose.ko to achieve privilege escalation
You may assumed that Busybox, the Linux kernel, and Qemu are not vulnerable.

Files
./share/rose.ko: The vulnerable driver
./src/rose.c: The source code of rose.c

Flag location
/home/user/flag

Notes
FG-KASLR is enabled
Your exploit should be kernel-agnostic. In other words, it should not rely on any kernel offsets

Points

296

Solves

17

Credits

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

TPCTF 2023 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A revenge of a classic intro challenge, now with a small-slab UAF; overwrite something everyone runs.

Mitigations: SMEP, SMAP, 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 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, run.sh.

Original challenge

Description

喜闻乐见的内核题怎么搞出非预期了?

Points

666

Solves

11

Credits

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

MntcrlCTF 2026 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A nameless driver keeps a global pointer after free; a friendly first step into pipe_buffer tricks.

Mitigations: SMEP, SMAP, KASLR, KPTI, KVM

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 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): MonteDriver.c, bzImage, initramfs.cpio.gz, run.sh.

Original challenge

Description

Oh no, this challenge doesn't have a name

Points

498

Solves

3

Credits

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

BackdoorCTF 2024 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A cute driver with a not-so-cute double free in a large cache; combine message queues and pipes.

Mitigations: SMEP, KASLR, no SMAP, no 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. The original kept its flag as a string inside the challenge module; the handout's module holds only a placeholder. In this dojo the flag is /flag (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, config, initramfs.cpio, run.sh.

Original challenge

Description

A simple little kernel challenge

Note: No brute-force is required for this challenge

Points

498

Solves

4

Credits

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

DownUnderCTF 2024 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A driver's fault handler hands out pages a bit too generously; no ROP needed if you think about files.

Mitigations: SMEP, SMAP, KASLR, 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 handout has no flag file; in this dojo it is /flag (root only). With panic=0 (as in the original) a kernel panic hangs the VM; quit with Ctrl-A then X.

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, src.c.

Original challenge

Description

Keep your valuable data safe in a shared buffer!

Points

335

Solves

15

Credits

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

IERAE CTF 2024 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A small allocator driver gets its frees wrong; turn the heap overlap into a write to a file you should not control.

Mitigations: SMEP, SMAP, KASLR, 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. As in the original, the shell runs as uid 9999 with ulimit -n 12.

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, chal.c, chal.ko, rootfs.cpio.gz, run.sh.

Original challenge

Description

Have you ever wondered if an object is really deleted? Don't worry, now you have SUPER DELETE

<flag>

Points

477

Solves

2

Credits

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

Codegate CTF 2025 Preliminary · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A page-sized kernel buffer is freed while still reachable; pick the right object to land in its place.

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 /home/ctf/exploit. Your exploit is put at /home/ctf/exploit, where the original's upload bridge put 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): Kconfig, bzImage, rootfs.img.gz, run.sh.

Original challenge

Description

Points

358

Solves

13

Credits

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

THJCC CTF 2026 · difficulty ★★☆☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A pipe-related kernel change leaves a flag where it should not be; a modern take on a famous bug.

Mitigations: SMEP, SMAP, KPTI, KASLR, panic_on_warn=1, noapic

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 /tmp/e (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, diff.patch, initramfs.cpio, kernel.config, run.sh.

Original challenge

Description

問おう。あなたがわたしのマスターか?

(Please solve this challenge locally before connecting to the remote server.)

Notice

The main files to focus on for this challenge are located in the src/challenge/ directory.
When you connect to the server, it will require solving a PoW. The PoW solver script is located at solver/solve_pow.py.
After solving PoW, the server will ask if you want to upload your exploit — provide the URL of your exploit file to do so.
When QEMU startup, you can find your exploit at /tmp/e.
If you have any problem about linux kernel challenge environment, please refer to the challenge others source code.

Points

476

Solves

17

Credits

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

D^3CTF 2026 · difficulty ★★★☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

The first version of the message bus driver; its revenge sibling comes right after it.

Mitigations: SMEP, SMAP, KASLR, KPTI, SMP 4 vCPU

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 a qcow2 disk, so there is no initramfs to add files to: transfer your exploit over the console (for example base64). The flag is /flag (copied from a second disk at boot); 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, kernel_config, rootfs.qcow2, run.sh.

Original challenge

Description

d3kbus.service-D3KBUS Pwn Environment
tcp(raw)
「  Everynight I look to the skies and wonder what we did

    Always a naive point of view that breaks us in the end

    If I could find the meaning of it all I'd take the chance

    Maybe in time we'll walk the mile and change it if we can 」

Copyright(c) 2026 <ディーキューブ・シーティーエフ カーネル Pwn 製作委員会>

Points

661

Solves

78

Credits

  • Challenge author(s): arttnba3 @ L-team x El3ctronic x D^3CTF, for D^3CTF 2026
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

D^3CTF 2026 · difficulty ★★★☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A message bus driver validates checksums in a way that lets a few bytes slip into places they should not.

Mitigations: SMEP, SMAP, KASLR, KPTI, SMP 4 vCPU

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 a qcow2 disk, so there is no initramfs to add files to: transfer your exploit over the console (for example base64). The flag is /flag (copied from a second disk at boot); 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, kernel_config, rootfs.qcow2, run.sh.

Original challenge

Description

「  出发啦 那黑的路东或西

看不见的 只会是目的地

出发啦 那夜的人福祸兮

命运哎呀 像座遗迹 」

Copyright(c) 2026 <ディーキューブ・シーティーエフ カーネル Pwn 製作委員会>

Points

776

Solves

60

Credits

  • Challenge author(s): arttnba3 @ L-team x El3ctronic x D^3CTF, for D^3CTF 2026
  • Compiled by: mito753 in Kernel-Exploit-Dojo, which also has the original handout and writeups

UofTCTF 2026 · difficulty ★★★☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

You are handed the power to plant probes in privileged programs; one well-placed byte is enough to change the story.

Mitigations: SMEP, SMAP, KASLR, SMP 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 a statically linked exploit at /home/hacker/exploit first; it appears in the VM as /exploit. Log in on the console as ctf (no password).

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, start-qemu.sh, uprobe-runner.go, uprobe-runner.gz, uprobe.bpf.c.

Original challenge

Description

uprobes are cool

Note: You can log in as the ctf user

Points

N/A

Solves

14

Credits

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

LA CTF 2025 · difficulty ★★★☆☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A messaging driver overflows by just three bytes; choose a neighbour where three bytes are enough.

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

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): Makefile, bzImage, initramfs.cpio.gz, kconfig, kernel.dockerfile, msgutil.patch, run.sh.

Original challenge

Description

i love sending messages, so i made it possible to add just a few more bytes to them

Points

463

Solves

10

Credits

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

N1CTF 2023 · difficulty ★★★★☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

All you can do is subtract a small number at a fixed offset; pick the right victim object and that is enough.

Mitigations: SMEP, SMAP, KASLR, KPTI (kernel default; depends on the host CPU), oops=panic, 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 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, kconfig, qemu.sh, rootfs.cpio.

Original challenge

Description

A Linux kernel challenge

https://drive.google.com/file/d/15nOUyyhl5pVElYGlVWTzqVHlmsQc6vrg/view?usp=sharing

 Challenges Hints:
The object's random size will return to userland by syscall return code

 Challenges Hints:
Try diff the given config with defconfig

Points

430

Solves

4

Credits

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

hxp CTF 2021 · difficulty ★★★★☆ · module: pipe_buffer, Dirty Pipe and Page Cache Overwrites

A driver that pins user pages for writing without asking for write access; think about what read-only pages really mean.

Mitigations: SMEP, SMAP, 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): bzImage, helpful-material/kernel-build-config, helpful-material/trusty_user_diary.c, helpful-material/trusty_user_diary.h, initramfs.cpio, run.sh.

Original challenge

Description

Your daily linux kernel pwnable. Have fun!

Connection (mirrors):

Points

588

Solves

8

Credits

  • Challenge author(s): sisu, for hxp CTF 2021
  • 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