REDMI K90 Max在OS4.0.5.0.XAACNXM利用CVE-2026-98260获取ROOT权限并加载KSU模块。
One-click root on REDMI K90 Max (prague / 2604FRK1EC): exploit CVE-2026-98260 (a POSIX CPU timer UAF in the exec subsystem) to gain arbitrary kernel read/write, achieve root + load the official KernelSU 3.3.1, and package it as an Android App.
[!WARNING] This project modifies kernel memory and loads unsigned kernel modules. It may cause system panic, data loss, or prevent the device from booting. Use only on your own device, and confirm that the device model and kernel version match before running.
The core of CVE-2026-98260 is the cleanup order of begin_new_exec() in fs/exec.c: de_thread() has already swapped out the thread's TID, while posix_cpu_timers_exit() only executes after exec_mmap() succeeds. If the intermediate step fails, the timer node is never removed.
B 线程 execve
└─ de_thread() 交换 TID,B 的 pid 转给已死的 leader,随即 release_task(leader)
└─ exec_mmap() mmap_read_lock_killable 被 SIGKILL 打断 → -EINTR
└─ begin_new_exec 失败 point_of_no_return 已置位 → B 被杀
└─ do_exit → exit_itimers()
└─ posix_cpu_timer_del() pid_task(it.cpu.pid, PIDTYPE_PID) 返回 NULL
⇒ goto out,既不 disarm 也不 WARN
└─ k_itimer 被释放,但 timerqueue 节点还挂在 B 的树上
父进程 wait4 → release_task(B) → posix_cpu_timers_exit(B)
└─ cleanup_timerqueue() 对已释放的节点做 rb_erase ⇒ UAF 写
From the release of k_itimer to the parent process's wait4 triggering rb_erase, an entire process scheduling interval passes in between. The window is under our own control — after B becomes a zombie, the parent process does not reap it, so the node stays linked.
This is also the fundamental reason for its high efficiency: the window is no longer a nanosecond-level phase; as long as the parent process does not rush to wait4, it is fine.
For the complete principle, see docs/01-vulnerability.md.
| Stage | What was done | Key technique |
|---|---|---|
| Trigger | Create the above UAF to obtain a controlled 8-byte write | SIGEV_SIGNAL's CLOCK_THREAD_CPUTIME_ID timer + sibling threads hammering mmap_lock + SIGKILL interrupting exec_mmap |
| stage0 | Land the controlled write on sysctl_bootid, and incidentally derive the KASLR slide | Cross-cache: after the order-1 slab of posix_timers_cache is returned to the buddy allocator, reclaim it with a pipe buffer |
| stage1 | Switch to configfs's miscdevice, using configfs's read_iter/write_iter as read/write primitives | Overwrite misc_list + file_operations to gain arbitrary kernel virtual address read/write |
| Privilege escalation | Directly modify the cred's uid/gid/caps | Arbitrary kernel write |
| KSU | Load the official KernelSU 3.3.1 LKM; ksu_patch_text() takes effect directly | 6.12's __set_pte() unconditionally issues dsb(ishst); isb(), so no shadow table is needed |
For details of each stage, see:
docs/02-exploit-chain.md — Trigger and privilege escalation chaindocs/03-kernelsu.md — KernelSU loadingWhy the trigger layer should be a separate layer
The trigger layer is in src/race_98260.inc, with only one criterion: R98260_GATE blocked=N:
blocked=1 → B is stuck on the read lock of exec_mmap; this round has a UAF, continue running spray;blocked=0 → B's exec succeeded, and the kernel cleaned it up itself; discard this round directly.This early exit can save the preparation of 6000 pipe pairs per round + 12000 RCU callbacks + 150ms slab wait.
There is only one return value between the trigger layer and the rest, so it can be replaced and verified independently — with ./exploit-prague-98260 --stageb you can run only the trigger layer and see whether blocked stably comes out as 1.
In addition, kprobe perturbation is not needed here to align the phase, so there are no tracefs operations in the App, and therefore no extra permissions are required.
The KernelSU hurdle
Official KernelSU works by rewriting an idle slot in sys_call_table (here slot 18, ni_syscall) into its own dispatcher, then using the sys_enter tracepoint to change the target syscall's number to 18 and forward it there.
On machines with 6.18 and later, this step cannot be written in: __set_pte() is wrapped into queue_pte_barriers(), and in the TIF_LAZY_MMU context it only sets pending and does not issue barriers, so the written instructions never enter the I-cache.
The local 6.12 does not have this problem. In arch/arm64/include/asm/pgtable.h:
static inline void __set_pte(pte_t *ptep, pte_t pte)
{
__set_pte_nosync(ptep, pte);
if (pte_valid_not_user(pte)) {
dsb(ishst);
isb(); // 无条件立即发射
}
}
After writing, the instruction immediately enters the I-cache, and when ret returns, it is the new instruction. In the logs you can see:
kernelsu: patch syscall 18, 0xffffffc0809a8f00 -> 0xffffffc0812ab4c0
kernelsu: dispatcher installed at slot 18
Both lines are present, which means this path goes straight through. Forcing in a shadow table would instead add an extra layer of risk, so a shadow call table is not used here.
For details, see docs/03-kernelsu.md.
KAIROS-KSU-98260/
├─ android/ Android App(Kotlin + Compose + Miuix)
│ └─ app/src/main/
│ ├─ java/com/chayewuu/prague98260/
│ ├─ jniLibs/arm64-v8a/ libexploit.so(exploit)、libprobe.so(环境探测)
│ ├─ assets/ KernelSU / KernelSU Next 管理器 APK 与对应 .ko
│ └─ res/
├─ src/
│ ├─ exploit-app.c stage0 / stage1 / 提权主链
│ ├─ race_98260.inc 98260 触发层(被 exploit 内联 include)
│ └─ ksu_symbols.inc UND 符号 → 内核链接地址(227 条)
├─ payload/ 编译产物
├─ tools/ BTF 偏移复测、符号表审计
└─ docs/ 技术文档
Scripts in tools/ run against the device's kernel Image (or vmlinux) to verify the offsets and symbols hardcoded in the source:
python tools/btf_recheck.py <Image> # 结构体偏移
python tools/ksu_sym_audit.py # .ko 的未定义符号是否都在表里
# 1. 编译 exploit(必须用 NDK 的 clang 包装器;不能加 -lpthread,pthread 在 libc 里)
aarch64-linux-android35-clang -std=gnu17 -O2 -Wall -static -fPIE -pie -pthread \
-o libexploit.so src/exploit-app.c
# 2. 拷进 Android 工程
cp libexploit.so android/app/src/main/jniLibs/arm64-v8a/
# 3. 打包
cd android && ./gradlew assembleRelease
The output is a statically linked ET_EXEC (no PT_INTERP, no dependency on a linker, and it can be exec'd directly in any SELinux domain). In this case, -pie will be reported as unused by clang, which is harmless.
In app/build.gradle.kts, keepDebugSymbols += "**/libexploit.so" must be kept: AGP strips the .so files in jniLibs by default, and a stripped exploit won't run.
The signature is read from keystore.properties and is not committed to the repository.
Prerequisites: USB debugging is enabled, and Shizuku has been started and authorized for this App.
KSU_LOAD_PASS, open the KernelSU Manager to complete authorization.Success criteria (the following should appear in the terminal in sequence):