
Staged Android kernel LPE research package for CVE-2026-64560 on Xiaomi 18 Pro: KASLR slide recovery, SELinux permissive, kprobe read, cred overwrite and LKM load.
Security research and auditable engineering sample on Xiaomi 18 Pro (
M610BB/ SM8950 / Android 17 / kernel 6.18.21).
This repository is compiled from the latest README, process reports, and staged source code of CVE-2026-64560-fullchain. The goal is to let security reviewers understand, compile, inspect, and reproduce the research process stage by stage.
This is not a one-click tool. This repository deliberately does not include reproduce.sh, tools/reproduce.py, or a wrapper that chains reboot, retry, patching, privilege escalation, KSU loading, and adb root into a single entry point. Each stage must be executed separately, with results checked and a decision made on whether to continue.
For use only on your own device, explicitly authorized devices, or isolated test environments. Kernel writes may cause panic, delayed corruption, or failure to boot automatically. Do not run on production devices or devices holding important data.
The research chain of the latest version is:
shell(2000)
-> CVE-2026-64560 命中
-> 悬空 rb_node 被 8KB AF_UNIX frag 重占
-> 受控页上的 rb-tree 写原语
-> SELinux permissive(保留 initialized)
-> kprobe 读 task/cred 地址
-> 两阶段写 cred:cap_bset=0,cap_effective=受控地址值
-> 未签名 LKM
-> ksud install / KernelSU-Next late-load
-> adb root shell
This is a temporary root valid within a single boot. Rebooting clears the memory module, the temporary SELinux state, and the adb root state; this chain does not write the bootloader, does not write boot/init_boot, and does not modify any partition.
2026-10-19 update: The "Developer options" crash after success has been located and fixed. Do not write
ro.debuggable=1; prefer authorizingshellin the KernelSU-Next manager, or useforce_feature=adb_root:1. If you have already written it, runbash tools/fix_devopts.sh --yes.
This repository does not guarantee it will run on other device models, other kernels, or other firmware; it does not guarantee a stable hit; it does not provide permanent root; it does not provide Bootloader unlocking, nor does it promise to bypass vendor signatures, AVB, or secure boot.
Each boot requires re-obtaining the KASLR slide, regenerating the kallsyms/LKM patch bound to that boot, and re-completing the stage checks.
CVE-2026-64560-public/
├── README.md
├── src/
│ ├── Makefile
│ ├── posix64560/
│ │ ├── t64560_v27.c # 夺页/落地 oracle,只观测、不写目标
│ │ ├── t64560_v33.c # 早期零写版本,归档参考
│ │ ├── t64560_v34.c # v34/v42/v43 同源:候选、自持、两阶段写
│ │ ├── t64560_v36.c # 安全零写,permissive 阶段使用
│ │ └── t64560_v40.c # 带 min_drain 的早期两阶段参考
│ ├── kprobe/
│ │ ├── grab_blocked.sh # ftrace RAW 抓取,推导 KASLR slide
│ │ ├── rd.sh / rd4.sh / rd5.sh
│ │ ├── forker.c
│ │ ├── kprobe_probe.c
│ │ └── ...
│ ├── reclaim/
│ │ └── filter_spray.c # SO_ATTACH_FILTER 备用回收器
│ └── rootshell/ # 历史 root shell / core_pattern 负结果参考
├── device/
│ ├── deploy.sh # 只推送阶段需要的文件
│ ├── setup_kprobe.sh # 创建并启用 __set_task_comm 探针
│ ├── launch_v36.sh
│ ├── launch_v34.sh
│ └── ...
├── tools/
│ ├── slide_now.py
│ ├── verify_slide.py
│ ├── mk_kallsyms.py
│ ├── ko_vermagic.py
│ ├── ko_patchsyms.py
│ ├── ko_patch_cred.py
│ ├── ko_patch_noenforce.py
│ ├── rootcmd.py
│ ├── rootwrite.py
│ ├── fix_devopts.sh # 修复 ro.debuggable 导致的开发者选项闪退
│ ├── cand_probe.py
│ └── ...
├── bin/ # 可选 aarch64 预编译参考二进制
├── ksu/ # KernelSU/KernelSU-Next 参考资产
├── LICENSES/ # 上游许可全文
├── docs/ # 00/137/139/147~158 等过程报告
└── evidence/ # 小型文本证据
bin/ is a precompiled reference artifact provided for reviewers to compare against; the source code and design documentation are the main content. The patched .ko files cannot be directly reused across different boots.
This directory does not include reproduce.sh, tools/reproduce.py, tools/gain_root.py, tools/post_permissive.py, the temporary logs and generated artifacts in out/, or the vmlinux.elf that does not match the target kernel. The latter is large in size and is a target firmware asset, so reviewers need to provide a file of the same version themselves.
机型 Xiaomi 18 Pro / M610BB / hongkong / SM8950
系统 Android 17 / OS4.0.9.0 / user build
补丁 2026-09-01
内核 6.18.21-android17-5-g1d099fcb35e0-abogki540753930-4k
The target device's uname -r must match exactly. Any character difference means the symbol offsets, structure layout, or patch assumptions are invalid.
adb, and confirm that only the target device is connected;pyelftools (required by the ko_* and slide helper scripts);aarch64-linux-gnu-gcc or the Android NDK;com.rifsxd.ksunext 3.4.2 as a reference);This repository retains small reference assets, but does not include the target device's vmlinux.elf. To perform KASLR derivation and re-patch the ko, the auditor must provide a vmlinux.elf with exactly the same kernel version as the target device, recommended to be placed at:
ksu/vmlinux.elf
When there is no vmlinux.elf of the same version, you can only substitute it with a snapshot of the target device's own /proc/kallsyms, and you must ensure that the snapshot is bound to the current boot.
Each stage has independent inputs, independent criteria, and failure handling. Do not proceed to the next stage if the criteria are not met.
| Phase | Purpose | Main files | Pass criteria |
|---|---|---|---|
| 0 | Confirm starting point, compilation, deployment | src/Makefile, device/deploy.sh | uid=2000, CapEff=0, SELinux enforcing |
| 1 | Obtain the KASLR slide of the current boot | src/kprobe/grab_blocked.sh, tools/slide_now.py | Multiple anchor sets yield the same slide |
| 2 | Make SELinux permissive | src/posix64560/t64560_v36.c | enforce=0, initialized=1, App usable |
| 3 | Set up kprobe arbitrary read | device/setup_kprobe.sh, src/kprobe/rd5.sh | Probe enabled, can read 8-byte raw values |
| 4 | Obtain target task/cred | src/kprobe/cand.sh, the --self channel of t64560_v34.c | task/cred addresses stable and verifiable |
| 5 | Two-stage cred write | t64560_v34.c (v34/v42/v43 same origin) | cap_bset=0, cap_effective is the target address value |
| 6 | Generate the LKM for the current boot | tools/mk_kallsyms.py and ko_* | finit_module rc=0, kernelsu Live |
| 7 | Install/verify KernelSU-Next | ksu/ksud.arm64, manager | /data/adb/ksu/bin in place, manager status as expected |
| 8 | Give adb shell root | KernelSU-Next authorizes shell; fallback force_feature=adb_root:1 | adb shell su -c id is uid=0, developer options normal |
t64560_v34.ccontains multiple run modes. It is only stage reference code, not a one-click entry point for this repository; reviewers must select the mode themselves, pass in the address for the current boot, and check the result of each step.
adb devices
adb shell id
adb shell getenforce
adb shell grep -E '^(Uid|CapEff|CapBnd|NoNewPrivs|Seccomp):' /proc/self/status
Expected:
uid=2000(shell)
CapEff: 0000000000000000
CapBnd: 00000000008000c0
Seccomp: 0
Seccomp: 0 表示 shell 当前没有 syscall filter;这不等于 root,也不等于 SELinux permissive。