ghostlock-app README

The project's README from github.com/YuKongA/ghostlock-app. As one markdown file: README.md.

GhostLock-App

中文: README_ZH.md

Documentation

For the complete device-porting workflow, kernel-family template links, and tuning rationale, see the Kernel Profile Porting Guide.

Rows explicitly marked Shizuku required run through a shell UserService. Start Shizuku with ADB and tap the status card to grant access; all other rows use the app's normal execution path.

Quick Start

Open GhostLock and tap Run. KernelSU (me.weishu.kernelsu), ReSukiSU (com.resukisu.resukisu), or KowSU (com.kowx712.supermanager) provides ksud for module loading; without it, W1/W2 still grant uid 0 but no module is loaded.

The execution chain is a pipeline of three components: a frontend (root_child startup/handoff), a backend (the CVE-2026-43499 futex primitive), and a middleware route. The catalogued combinations are instantiated at build time; the resolved profile selects which one runs. The route races two cores: on the 6.6/6.12 tree-waiter kernels the main thread hammers select while a consumer thread perturbs the waiter's priority; on the 6.1 compact-waiter kernels it drives getsockopt(TCP_ZEROCOPY_RECEIVE) through a punched-hole page; the 5.15 kernels use the multicast waiter. The CPU pair also comes from the resolved profile.

Command-Line Debugging

adb/shell has no seccomp filter, so W3 is skipped - handy for quick verification:

make -C src ghostlock
./gradlew exportKernelProfiles
adb push build/native/ghostlock /data/local/tmp/ghostlock
adb push build/kernel-profiles/<release>.bin /data/local/tmp/profile.bin
adb shell chmod 755 /data/local/tmp/ghostlock
adb shell /data/local/tmp/ghostlock --load-prebuilt-profile /data/local/tmp/profile.bin

Offset Extraction

tools/extract_rs derives offsets from a boot.img (plus optional xbl_config.img), a full OTA ZIP, or an http(s) URL pointing at one. kallsyms come from --kallsyms or are recovered from the image's embedded table. pselect_waiter_shift and off_slide_loggers_0_1 are derived by the built-in arm64 disassembler. MediaTek images have no xbl_config.img and usually no BTF: the physical load address is derived from kallsyms _text (override with --phys).

Push-Location tools/extract_rs
cargo build --release
Pop-Location
build/extract/release/ghostlock-extract.exe boot.img --xbl-config xbl_config.img --format conf --out profile.conf
build/extract/release/ghostlock-extract.exe OTA.zip --format conf --out profile.conf

--format conf is the extractor output: a flattened, self-contained profile (no include lines, the shared 6.x credential/KernelSnitch constants inlined, the route selected from --analysis evidence unless --route overrides it). The extractor emits every field the image actually yields and omits the rest; it never fills gaps from a neighbouring kernel family's guesses (unverified-family 6.6, the default -2, the 5.15 multicast constants, or a phys default). Every output is an unverified candidate: importable and parseable, with missing or invalid fields blocked by the app's pre-execution validation, so a successful run never implies device support. On 5.x it also derives the credential reference repair from init_cred and the multicast geometry from BTF (see docs/analysis/extractor-5x-derivation-plan.md). --format json stays for the v1 import path. To add a built-in profile, complete and validate the matching version-family template, save it as a standalone .conf profile, and add it to kernel_profiles/index.conf. The old C offsets.h registry is deprecated and removed.

Preflight

The extractor disassembles remove_waiter() before extracting offsets. Kernels with the fix are rejected with exit code 6; only vulnerable kernels continue.

On-device analysis

A full OTA can be analyzed entirely on the phone: boot plus xbl_config are extracted automatically. Pass --work-dir an app-writable dir when running inside the app sandbox. Cross-compile and push:

rustup target add aarch64-linux-android
$ndk = "$env:ANDROID_HOME\ndk\<version>\toolchains\llvm\prebuilt\windows-x86_64\bin"
$env:CC_aarch64_linux_android = "$ndk\aarch64-linux-android35-clang.cmd"
$env:AR_aarch64_linux_android = "$ndk\llvm-ar.exe"
$env:CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER = $env:CC_aarch64_linux_android
Push-Location tools/extract_rs
cargo build --release --target aarch64-linux-android
Pop-Location
adb push build/extract/aarch64-linux-android/release/ghostlock-extract /data/local/tmp/
adb shell /data/local/tmp/ghostlock-extract /sdcard/OTA.zip

Importing offsets without rebuilding the app

New kernels no longer need an app rebuild: tap Import offsets.conf (HOCON) and pick the extractor's flattened .conf, or use Import offsets.json (v1) for an older JSON report. v1 JSON is converted in-app, so nothing has to be pushed to the device: native always starts from the GLK1 document the app sends on stdin, and matches the current uname -r against the resolved profile before rejecting the kernel. Imports merge across files; a release already stored prompts before overwrite.

The app can also generate the profile itself — Parse OTA link (full OTA ZIP URL) and Parse image (boot.img + optional xbl_config.img) run the extractor in-process and write a flattened .conf into the app data dir on success:

# GhostLock kernel profile: 6.12.38-android16-5-g844001fb8721-ab14552068-4k (HOCON, self-contained).
release = "6.12.38-android16-5-g844001fb8721-ab14552068-4k"
schema_version = 1
kernel_major = 6
recommend_shizuku = 0
kernel_phys_load = 0xC7800000
route {
  select_stack {
    waiter_shift = 0
  }
}
fallback {
  to = "none"
}
kernelsnitch {
  collisions = 4
}
task_struct {
  prio = 148
  cred = 2304
}
cred {
  caps_offset = 48
  copy_size = 136
  usage_value = 1
  caps_count = 5
  caps_value = -1
}
offset {
  init_task = 37801728
  init_cred = 37891184
}

Credits & License

Based on the following projects, licensed under Apache License 2.0 (see LICENSE):

ghostlock-app (YuKongA/ghostlock-app)

Searching Database…

这是什么?GhostLock 是一个一键式 Android 应用,运行 CVE-2026-43499 内核漏洞利用,在匹配的易受攻击内核上授予 uid 0(root),之后可选加载 KernelSU 风格的模块。
这是 root 漏洞利用应用,还是像 Magisk 那样的 root 管理器?它是一个独立的漏洞利用执行应用,不是 root 管理器:它驱动的是 CVE-2026-43499 漏洞本身,之后只会交接给 KernelSU、ReSukiSU 或 KowSU 来加载模块;没有其中之一时,它仍会授予 uid 0,但不会加载任何东西。
怎么运行这个漏洞利用?打开 GhostLock 应用并点击 Run;它会自动匹配一个内置的内核配置文件,并为你的内核执行正确的利用路径。
我需要先安装 KernelSU 或 Shizuku 吗?漏洞利用本身不需要任何 root 管理器,但之后加载模块需要 KernelSU、ReSukiSU 或 KowSU 的 ksud 组件;标记为 'Shizuku required' 的步骤则改为通过 ADB 启动的 shell UserService 来运行。
它在任何 Android 内核上都能用吗?不能。GhostLock 用精确的 'uname -r' 对照内置配置文件检查设备内核,遇到不认识或已修补的内核会拒绝运行,因此某次运行成功绝不保证在未经测试的设备上也能支持。
CVE-2026-43499 到底是什么?它是一个内核 futex 原语缺陷,被用作该漏洞利用的后端,影响包括 5.15、6.1 和 6.6/6.12 在内的一系列 Linux 内核分支,每个分支都通过略有不同的竞态来利用。
我可以为内置列表之外的内核添加支持吗?可以——tools/extractrs 工具能从 boot.img、完整的 OTA ZIP 或其 URL 推导出所需的偏移量,并生成可导入应用内的 .conf 配置文件,无需重新构建 GhostLock。
这个漏洞利用的竞态在不同内核上具体是怎么工作的?因内核系列而异:6.6/6.12 内核让 select() 与一个扰乱等待者优先级的线程进行竞态;6.1 内核通过一个打洞页面驱动 getsockopt(TCPZEROCOPYRECEIVE);5.15 内核则改用多播等待者。
如果在已修补的内核上尝试会怎样?偏移提取器会先反汇编内核的 removewaiter() 函数,如果发现修复已存在就以退出码 6 退出,因此在提取任何利用偏移量之前,已修补的内核就会被拒绝。
Creator
YuKongA
Size
19.9 MB
Stars
2.1K
Updated
CommitOct 19
Age
2mo
Commits · 90 Days