This repository contains a local kernel exploitation lab setup with two execution environments:
- Buildroot VM (
vm-start.sh) - kernelCTF-style VM (
kernelctf-start.sh)
It also includes exploit PoCs, a loadable kernel module, and helper scripts to prepare matching kernels for VM and native runs.
exploits/user-space proof-of-concept exploits and helper binaries - seeexploits/README.mdmodule/loadable kernel module (lkm.ko) - seemodule/README.mdbuildroot-env/Buildroot image build inputs/scripts - seebuildroot-env/README.mdlinux-env/local Linux source download + prepare script - seelinux-env/README.mdkernelctf-env/kernelCTF download/prepare/rootfs patch scripts - seekernelctf-env/README.mdvmshare/host-shared directory mounted inside guests
Prepare local VM assets:
make prepare-vmBuild exploits + module and start VM:
make run-vmDownload releases, prepare per-release kernel trees, and patch rootfs:
make prepare-kernelctfBuild exploits + module for a selected profile and start kernelCTF VM:
make MODULE_PROFILE_KERNELCTF=kernelctf-6.12 run-kernelctfSupported kernelCTF profiles are defined in kernelctf-env/releases.map.
Use this when running directly on host/device kernels (not in the VM images).
| Target | Kernel family | Exploit binary | Module profile |
|---|---|---|---|
| Ubuntu | 6.5.0-14-generic | *.x86.elf |
ubuntu-old |
| Ubuntu | 6.8.0-101-generic | *.x86.elf |
ubuntu |
| Fedora | 6.18.13-200.fc43.x86_64 | *.x86.elf |
fedora |
| Raspberry Pi | 6.12.47+rpt-rpi-v8 | *.arm.elf |
rasp |
| Android | 6.1.145-android14 | *.arm.elf |
no dedicated native profile (see note below) |
Android note:
- Exploit binaries are supported (
make -C exploits arm+adb push). - A native Android module profile is not defined in
module/Makefile, but can be directly be used.
Exploits:
make -C exploits x86
make -C exploits armModule examples:
make -C module PROFILE=ubuntu-old all # Ubuntu 6.5
make -C module PROFILE=ubuntu all # Ubuntu 6.8
make -C module PROFILE=fedora all # Fedora 6.18
make -C module PROFILE=rasp all # Raspberry 6.12Insert/remove module on native Linux systems with module support:
make -C module insert
make -C module removemake build-exploits
make build-module
make build-module-vm
make build-module-kernelctf MODULE_PROFILE_KERNELCTF=kernelctf-6.12make,gcc,git,curl,awkqemu-system-x86_64(for VM runs)aarch64-linux-gnu-gcc(optional, for ARM exploit builds)debugfs+fdisk(forkernelctf-env/patch-rootfs.sh)- kernel headers/source for module builds
adb(optional, for Android/ARM deploy viamake -C exploits push)
Fedora v6.18 - Successful msg_msg reclaim:
run-fedora.webm
KernelCTF v6.12 - Successful msg_msg reclaim:
run-kernelctf.webm
KernelCTF v6.12 - Successful pipe_buffer reclaim:
run-kernelctf-pipe.webm
Android untrusted_app - Successful pipe_buffer reclaim. Here, the second terminal is for validation the leaked pipe_buffer address, showing the correct slab kmalloc-cg-1k owner:
run-app.webm
Unless noted otherwise, this repository is licensed under the MIT License.
Exceptions:
module/— the loadable kernel module and the vendoredslab-*.hheaders are derived from the Linux kernel and are licensed under GPL-2.0 (see the SPDX identifiers in those files).exploits/futex_hash.h— embedsjhash.hfrom the Linux kernel; the embedded portions retain their original licensing terms (see the inline attribution block).