The Dirty Frag PoC is a single C file (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/V4bel/dirtyfrag/llms.txt
Use this file to discover all available pages before exploring further.
exp.c) that compiles with one gcc command and runs as an unprivileged user. It automatically tries the ESP variant first, then falls back to the RxRPC variant, and drops you into a root shell on either path. This page covers compilation, invocation options, and mandatory cleanup.
Prerequisites
- A Linux system running a vulnerable kernel (ESP path: kernel
cac2661c53f3– present; RxRPC path: kernel2dc334f1a63a– present andrxrpc.koloadable) gccinstalled- A terminal session running as an unprivileged user — the exploit escalates to root itself; you do not start as root
gitavailable to clone the repository
One-liner
Step-by-step
Compile with gcc
Use the exact flags from the README.
-O0 disables optimizations so the compiler does not reorder the splice/vmsplice sequence; -lutil links posix_openpt for the PTY bridge.Run the exploit as an unprivileged user
ESP variant succeeds: patched /usr/bin/su gives a root shell
If the ESP path works, the exploit overwrites the first 192 bytes of
/usr/bin/su in the page cache with a minimal root-shell ELF. When execve("/usr/bin/su") runs, the kernel maps the patched page. Because /usr/bin/su carries the setuid bit, the process gains euid=0 immediately and executes /bin/sh.You land in a root shell.ESP variant fails: RxRPC variant patches /etc/passwd
If the ESP path fails (for example, because AppArmor blocks unprivileged user namespace creation), the exploit falls back to the RxRPC variant. This path does not require a user namespace.The RxRPC variant uses three in-place The exploit’s PTY bridge handles this automatically — you do not need to type anything.
pcbc(fcrypt) decryption STOREs to rewrite the root entry in the /etc/passwd page cache so that the password field is empty. PAM pam_unix.so’s nullok option then accepts an empty password for root.Run su - with no password input to get a root shell:Cleanup: clear the contaminated page cache
After you finish, the page cache still holds the modified bytes. Clear it before continuing to use the system:Or reboot:See the Cleanup section below for details.
Options and environment variables
Verbose output
SetDIRTYFRAG_VERBOSE=1 to print detailed progress to stderr. This shows namespace setup, XFRM SA registration, splice results, and the post-write byte verification:
-v or --verbose on the command line:
Force a specific variant
By default the binary tries the ESP variant first and falls back to RxRPC. Use these flags to force a single path:--force-rxrpc retries the RxRPC path up to three times if the first attempt does not leave /etc/passwd in the expected state.
Other flags
| Flag / env var | Effect |
|---|---|
--force-esp | Skip the RxRPC fallback; only attempt the ESP path |
--force-rxrpc | Skip the ESP attempt; only attempt the RxRPC path (retried up to 3×) |
-v / --verbose / DIRTYFRAG_VERBOSE=1 | Enable per-step progress output to stderr |
DIRTYFRAG_CORRUPT_ONLY=1 | Perform the page-cache write but skip spawning the root PTY |
Cleanup
Two options are available: Drop the page cache (no reboot required):/usr/bin/su or /etc/passwd reads the correct bytes from disk.
Reboot the system:
drop_caches is unavailable or you want to ensure a fully clean state.
What happens internally
The exploit chains two distinct page-cache write primitives. For a full walkthrough of the C code, see How the Dirty Frag exploit code works. ESP path — injects a 192-byte root-shell ELF into the/usr/bin/su page cache via XFRM SA STOREs. Each of 48 XFRM SAs carries 4 bytes of the ELF payload in its seq_hi field. A vmsplice + splice + splice sequence plants the /usr/bin/su page cache page into an skb frag, and esp_input() performs an in-place AEAD decryption STORE directly on that page.
RxRPC path — nulls the root password field in the /etc/passwd page cache via pcbc(fcrypt) STOREs triggered through the RxRPC/rxkad handshake. An offline brute-force search over the 56-bit fcrypt key space finds three keys whose decryption outputs overwrite the password field with ::. Three kernel triggers apply the STOREs in sequence. PAM’s nullok option then accepts the empty password.