woshimaniubi8/CVE-2026-43499-root-KernelSU
GitHub: woshimaniubi8/CVE-2026-43499-root-KernelSU
基于内核漏洞 CVE-2026-43499 的 Android 本地提权工具,集成 KernelSU 以 late-load 模式获取 root 权限。
Stars: 0 | Forks: 0
# CVE-2026-43499-root-KernelSU
基于内核漏洞CVE-2026-43499的本地提权适配,集成嵌入式 KernelSU 。
编译生成`preload.so`;触发成功后会以 `late-load` 模式(越狱模式)启动 KernelSU。
支持(xbl_config.img / vendor_boot.img) + boot.img 生成target.h,或其他方式。
参考的项目:
- [Linuxoid-cn/CVE-2026-43499-Poc-Analysis](https://github.com/Linuxoid-cn/CVE-2026-43499-Poc-Analysis/)
- [x-spy/CVE-2026-43499-popsicle](https://github.com/x-spy/CVE-2026-43499-popsicle)
- [Colorful-glassblock/duchamp-root](https://github.com/Colorful-glassblock/duchamp-root)
## 影响范围
**当您的内核版本为 {Linux Kernel} 时,处在本次漏洞的影响范围**
- Linux Kernel < commit **3bfdc63936dd4773109b7b8c280c0f3b5ae7d349**
- **2.6.39** <= {Linux Kernel} < **6.1.175**
- **6.2** <= {Linux Kernel} < **6.6.140**
- **6.7** <= {Linux Kernel} < **6.12.86**
- **6.13** <= {Linux Kernel} < **6.18.27**
- **6.19** <= {Linux Kernel} < **7.0.4**
## 当前状态
| Target | 状态 |
| --- | --- |
| `rodin`(默认) | 已验证 |
| 其他 `src/targets/*` | 参考 |
## 目录结构
```
.
├── Makefile
├── build/
│ └── embed/
│ └── ksud # 被嵌入 preload.so 的 KernelSU userspace binary
├── tools/
│ ├── generate_target.py # 本仓库统一 target.h 生成入口
│ └── vendor/ # 从父目录同步的原始生成辅助脚本
└── src/
├── main.c # exploit 主流程
├── preload.c # LD_PRELOAD constructor + ksud 写出/启动
├── root.c # cred/seccomp/SELinux/root patch
├── slide.c # pselect KASLR slide leak
├── fops.c # pselect/FOPS route
├── pipe.c # pipe-buffer phys R/W primitive
├── ksud_blob.S # .incbin build/embed/ksud
├── kernelsnitch/ # KernelSnitch helpers
└── targets/
├── rodin/
├── beryl/
└── ...
```
## 构建
### 依赖
- Linux 主机
- Android NDK
- 默认路径:`~/android-ndk-r29`
- 或设置:`ANDROID_NDK_HOME` / `ANDROID_NDK_ROOT` / `NDK_ROOT`
- `make`
- `git`
### 构建
```
make PROJECT= -j$(nproc)
```
输出:
```
build//bin/preload.so
```
### 查看可用 target
```
make list-projects
```
## 生成 target.h
本仓库已经内置统一 target 生成脚本:
```
tools/generate_target.py
tools/vendor/generate_target.py
tools/vendor/generate_target_2.py
tools/vendor/detect_offset.py
```
`tools/generate_target.py` 是入口脚本。它参考并封装了父目录所有 target 生成流程,最后输出适配本仓库源码的完整 `src/targets//target.h`。
#### 1.使用 boot.img + profile JSON 生成
```
make generate-target PROJECT= BOOT=/path/to/boot.img PROFILE=/path/to/profile.json
```
默认写入:
```
src/targets//target.h
```
也可以直接调用脚本:
```
tools/generate_target.py --project --boot /path/to/boot.img --profile /path/to/profile.json
```
`profile.json` 需要包含物理地址信息,例如:
```
{
"p0_phys_offset": "0x40000000",
"p0_kernel_phys_load": "0x40000000"
}
```
#### 2.从已 root 的 ADB 设备检测 profile
只生成 profile:
```
make detect-profile PROFILE_OUT=profile.json
```
检测 profile 并立即生成 target:
```
tools/generate_target.py --project --boot /path/to/boot.img \
--detect-adb-and-generate --profile-out profile.json
```
#### 3.(xbl_config.img / vendor_boot.img) + boot.img 生成
脚本同时暴露父目录生成器支持的其他入口:
```
tools/generate_target.py --project --boot boot.img --xbl-config xbl_config.img
tools/generate_target.py --project --boot boot.img --mtk-vendor-boot vendor_boot.img
tools/generate_target.py --project --boot boot.img --mtk-partitions /path/to/partitions
```
##### 示例
```
make generate-target PROJECT=rodin BOOT=../rodin/boot_a PROFILE=../profile.json
make generate-target PROJECT=beryl BOOT=../beryl/boot.img PROFILE=../profile.json
```
成功输出形态:
```
生成成功: .../src/targets//target.h
kernel SHA-256:
target macros: 168
```
`rodin` 会默认保留实机验证过的:
```
#define MM_STRUCT_SZ 0x500
```
如需覆盖:
```
tools/generate_target.py --project rodin --boot boot.img --profile profile.json --mm-struct-sz 0x...
```
## 添加新 target
推荐从匹配的 boot image 和 profile 生成:
```
make generate-target PROJECT= BOOT=/path/to/boot.img PROFILE=/path/to/profile.json
make PROJECT= -j$(nproc)
```
一个完整 target header 会包含:
- direct map / physical profile 常量
- KASLR slide object 偏移
- task / cred / SELinux 偏移
- pipe / fops / configfs 偏移
- pselect layout 值,例如 `PSELECT_WAITER_WORD_SHIFT`
- `MM_STRUCT_SZ` 与 KernelSnitch 调参值
## 运行
当前源码已写入默认值,正常运行只需要设置 `LD_PRELOAD`,并执行任意程序(建议 `toybox id`)。
```
adb push build/rodin/bin/preload.so /data/local/tmp/preload.so
adb shell 'chmod 755 /data/local/tmp/preload.so'
adb shell 'LD_PRELOAD=/data/local/tmp/preload.so /system/bin/toybox id'
```
## 默认运行参数
当前默认配置如下:
| 设置 | 默认值 | 说明 |
| --- | --- | --- |
| `KSUD_LATE_LOAD` | `1` | 执行 `ksud late-load` |
| `KSUD_ALLOW_SHELL` | `1` | 传入 `--allow-shell` |
| `KSUD_PACKAGE` | `me.weishu.kernelsu` | 传给 ksud 的管理器包名(貌似不起效) |
| `KSUD_DST` | `/data/local/tmp/ksud` | 内置 ksud 写出路径 |
| `KSUD_SKIP_WRITE` | `0` | 默认写出内置 ksud |
| `KSUD_DEFER_TO_PARENT` | `1` | 从已 patch 的父/当前进程路径启动 ksud |
| `ROOT_PATCH_SELF` | `1` | patch 当前进程为 uid 0 |
| `DISABLE_SELINUX` | `1` | root patch 时将 SELinux enforcing 写为 permissive |
| `ROOT_EXIT_SLEEP` | unset / `0` | 返回前不额外 sleep |
默认实际执行的 ksud 命令行为:
```
/data/local/tmp/ksud late-load --allow-shell --package-name me.weishu.kernelsu
```
这些环境变量仍然可以在运行时覆盖,例如:
```
adb shell 'KSUD_PACKAGE=com.example.manager LD_PRELOAD=/data/local/tmp/preload.so /system/bin/toybox id'
```
复用已经写出的 `ksud`:
```
adb shell 'KSUD_SKIP_WRITE=1 LD_PRELOAD=/data/local/tmp/preload.so /system/bin/toybox id'
```
## 清理
```
make clean
```
`make clean` 会保留 `build/embed/ksud`,因为 `src/ksud_blob.S` 通过下面的方式嵌入它:
```
.incbin "build/embed/ksud"
```
如果手动清理导致 `build/embed/ksud` 丢失,可以恢复:
```
git checkout -- build/embed/ksud
```
## 常见问题
### 未找到 `.incbin "build/embed/ksud"`
恢复内置 payload 后重新构建:
```
git checkout -- build/embed/ksud
make PROJECT=rodin -j$(nproc)
```
### FOPS route 返回 `success=0`
`rodin` 期望使用 legacy/simple pselect layout:
```
pselect fdset simple layout shift=0
pselect returned attempt=1 ret=9 ... success=1
```
如果设备状态被失败尝试污染,直接重启后再试:
```
adb reboot
```
### `F_SETPIPE_SZ` 返回 `EPERM`
通常是失败/残留尝试导致的状态问题,重启是最快清理方式:
```
adb reboot
```
### `ksud` 启动但 `/proc/modules` 没有 KernelSU
查看日志:
```
adb shell 'cat /data/local/tmp/ksud.log /data/local/tmp/ksud.preload.log 2>/dev/null || true'
```
必要时在 root shell 中手动运行:
```
/data/local/tmp/ksud late-load --allow-shell --package-name me.weishu.kernelsu
```
## 许可证
GPL-3.0. 见 [`LICENSE`](LICENSE)。
标签:Android, DSL, KernelSU, Web报告查看器, 内核漏洞, 客户端加密, 本地提权, 越狱, 逆向工具