English | 简体中文
Android local privilege escalation research on the wacom HID sibling-removal
use-after-free, reachable from the shell SELinux domain through /dev/uhid.
This repository contains the 6.18.21 port (OnePlus 16 PYB110) and the probe
tools used to build and verify it. The upstream 5.15 port
(woshigenm/CVE-2026-99491) is
kept under upstream/CVE-2026-99491.
| Item | Value |
|---|---|
| CVE | CVE-2026-99491 (chain also uses CVE-2026-98499) |
| Class | LPE (UAF write / fixed 8-byte store) |
| Target | aarch64 Android 17, shell domain, /dev/uhid + wacom HID |
| Kernel | 6.18.21-android17-5-g7fcbffcad3e1-ab16353812-4k |
| SELinux | Enforcing at rest — temporary KernelSU LKM, manager crowned, Enforcing restored |
| Patches | absent: upstream ef32877368a7 (6.12 backport 1178927ffa54) |
| Status | EXP — KernelSU LKM loaded from the shell domain; zygote restarts, Wi-Fi and screenshots stay functional |
wacom_wac_shared caches the sibling input_dev of a stylus+touch pair in
shared->touch_input. Removing the sibling frees that input_dev without
clearing the pointer, so the surviving pad keeps reporting switches to freed
memory (wacom_wac_pad_event → input_report_switch). /dev/uhid lets the
shell domain create the pair and supply every report, so both the free and
the re-report are controlled from userspace.
The 6.18 layout shifts the cached pointer by 8 bytes: the ToolSerial OOB read
addresses uhid_device + 0x50 + 4*index (5.15 uses +0x58) and
work.func sits at +0x2408 (indices 2286/2287).
- KASLR leak (CVE-2026-98499). A uhid anchor's forged ToolSerial usage
array makes
wacom_wac_pen_serial_enforce()read 32 bits atuhid + 0x50 + 4*indexand deliver them asEV_MSC/MSC_SERIALon a shell-readable evdev node. Indices 2286/2287 yielduhid_device_add_worker(CFI thunk) → KASLR slide. - Cred discovery.
kmem/rss_stat/triggerenableskmem_cache_alloc/kmalloc. The parent drains the per-CPUtrace_pipe_rawbuffers while the exec child runs, then scans for the post-exec committed cred (bytes_req 0xb8,prepare_credscall-site low210x15350c, cache namecred) and the followingkmallocblob (call-site low210x15d9ac,bytes_req 0x28). The 6.18 raw record layout iscall_site@+8, ptr@+16, string@+24, bytes_req@+32, bytes_alloc@+40. - Write primitive. The UAF frees the sibling
input_dev(kmalloc-2k,sizeof=0x640); an skb spray reclaims it with a fakeinput_devwhosevalspointer is arbitrary. The pad's MUTE report still callsinput_event(), andinput_handle_event()stores a fixed 8-byteinput_valueat that pointer with no indirect call:- switch word
05 00 0e 00 00 00 00 00({EV_SW, SW_MUTE_DEVICE, 0}); - SYN word: leave
sw[]clear so the switch event is dropped andinput_sync()'sEV_SYN/SYN_REPORTappends eight clean zero bytes. Verified offsets:evbit@0x28 swbit@0xc8 sw@0x1c0 num_vals@0x5e8 max_vals@0x5ec vals@0x5f0.
- switch word
- Credential patch (minimal). Only two fields are written: a SYN word at
cred+0x20clearsfsuid/fsgid, and a switch word atcred+0x42yieldsCapEff=0x0e00050000(SYS_MODULE, SYS_CHROOT, MAC_ADMIN, SYSLOG, WAKE_ALARM).uid/euidare deliberately left at 2000: ColorOS'soplus_secure_guard_newemits aroot_checkkevent when a tracked process turns uid/euid 0 without a setuid syscall, andcom.oplus.exsystemservicethen reboots the device. Fields are verified by re-reading/proc/<pid>/status; only missed fields are rewritten. - SELinux window. The SYN word at
selinux_state+0zeroesenforcing,initializedand the firstpolicycapbytes (this build:enforcing@0,initialized@1,policycap@2..0xa; the policy pointer is at+0x40).initializedis restored with the switch word at+1. The running policy (2.3 MB) is then read from/sys/fs/selinux/policyand written back to/sys/fs/selinux/load, which rebuildspolicycapand keeps later zygote restarts working. Inside the windowoplus_secure_guard_newis unloaded; it is the only kernel producer of theroot_check/spolicy_reloadkevents (and is auto-reloaded), so the full uid/euid patch is racy and is not part of the default chain. The stock policy must not be reloaded after the module is live: that wipes the injectedksudomain and su falls back to theshelldomain (control-property writes are then denied). - KernelSU bootstrap. The manager's bundled KO (
<KMI>_kernelsu.ko,android17-6.18) is loaded in-process: undefined symbols (235, all present) are bound tolink address + slidefrom a static table, the image is passed tofinit_modulethrough a memfd withallow_shell=1, andEnforcingis restored immediately. The KO's own init crowns the manager: thepackages.listpath in the image is redirected to/data/local/tmp/pkg.list, which letstrack_throne()verify the manager APK and callCrowning manager: uid=<uid>. After the load the chain repairs the vendor rule lost by the runtime policy injection:ksud sepolicy patch 'permissive hal_audio_default'. With the injected policy,security_compute_avforhal_audio_default self:socketreturns an empty allowed mask; a restarted audio HAL then dies (agm_init -131, avcsocket create) andsystem_serverblocks inAudioDeviceBroker.initAudioHalBluetoothStatewaiting for AudioFlinger, which stalls every framework restart at the boot animation. - Post. Sets
persist.sys.oost.system_root_detection_blocked=1and verifiescolor_screenshotis registered bycom.oplus.exsystemservice. The package is not killed or disabled (the guard unload already removes the kevent source), so screenshots keep working.
[p] patch total 171ms uid=0 euid=0 fsuid=1 cap=1
[f] permissive=1366ms mls=1
[f] guard_left2=0 1429ms
[f] reloadpolicy=1 1431ms
[f] module_live=1 enforce=1 total=1733ms
150 color_screenshot: [com.oplus.screenshot.IOplusScreenshotManager]
[f] root_post done 1998ms guard_left=0
[f] fast rc=0
Soft reboot (ctl.restart zygote) completes: new zygote64/system_server
pids, sys.boot_completed=1, launcher focused, audio HAL and audioserver
running.
.
├── tools/ # device-side probes (C, static where needed)
│ ├── ctest.c # fast chain: cred discovery, minimal patch,
│ │ # permissive window, KSU load, audio-rule repair
│ ├── wtest.c # OOB leak + UAF write primitive probes
│ ├── agent.c # patched helper (loadksu/reloadpolicy/unloadguard/run)
│ ├── uaf_write.inc # shared write/leak primitive
│ ├── ksu_syms.h # ksu.ko imports → 6.18.21 link addresses
│ └── capdump.c # capability probe
├── device/pyb110/ # g7fcbff kallsyms dump, uhid disassembly
├── notes/ # measured offsets, indices and run records
└── upstream/CVE-2026-99491 # 5.15 reference port (GPL-2.0)
/data/local/tmp/agent,/data/local/tmp/ctest,/data/local/tmp/wtest/data/local/tmp/ksu.ko— manager KO with thepackages.listpath redirected to/data/local/tmp/pkg.list/data/local/tmp/pkg.list— one line<manager-package> <manager-uid>- a KernelSU manager installed (its
libksud.soprovidesdebug su)
adb shell '/data/local/tmp/ctest -e /data/local/tmp/agent -f'One call performs discovery, the minimal cred patch, the permissive window,
the policy reload, the guard unload, the in-process module load and the
audio-rule repair. Expect [f] fast rc=0 and kernelsu ... Live with
Enforcing afterwards.
Extract the KO from a manager APK with:
KSUD=/data/app/<install>/me.weishu.kernelsu-<hash>/lib/arm64/libksud.so
$KSUD debug extract-binary android17-6.18_kernelsu.ko /data/local/tmp/ksu.ko| Mitigation | State |
|---|---|
| KASLR | on — slide leaked through the wacom OOB read (CVE-2026-98499) |
| SMEP / SMAP / PAN | on |
| SELinux | Enforcing at rest; the EXP writes selinux_state, reloads the running policy and repairs one vendor rule |
| tracefs | shell-writable rss_stat trigger (required for the cred/blob trace) |
| module load | finit_module from the permissive window with allow_shell=1, with the guard module unloaded, then Enforcing restored |
- The chain uses CVE-2026-98499 (same wacom HID surface, unfixed here) for the KASLR slide; it is a two-CVE chain, not a 99491-only exploit.
- The cred/blob trace depends on the ROM exposing the
rss_stattrigger to the shell user. The per-CPU ring is small; the parent must drain it while the exec child runs or the earliest records are overwritten. - A missed kmalloc-2k reclaim is possible; the tools retry, and a retried trigger can be unstable.
- The permissive window includes a full policy reload before the module
load. Never reload the stock policy after the module is live: the injected
ksudomain is lost and su falls back toshell. - KernelSU's runtime policy injection drops some vendor allows on this
policy (observed for
hal_audio_default). The chain repairs the audio one; other vendor services restarted after the run may hit similar gaps. ksu_credinherits the loader's creds, so it stays non-root (uid/euid 2000) in this chain. Paths that need a fully root template (some sucompat and mount helpers) are not exercised; su itself uses the root profile.- The full uid/euid patch is racy:
oplus_secure_guard_newis auto-reloaded and reportsroot_checkon uid/euid 0 transitions, which leads to the exsystemservice reboot dialog. Only the minimal patch is used. - The symbol table and the KO are specific to the 6.18.21
g7fcbffbuild and theandroid17-6.18KMI; regenerate the table and re-extract the KO for another build. The manager uid inpkg.listmust match the installed manager. - The validated soft reboot is
ctl.restart zygote. KernelSU's emulated soft reboot (ksud soft-reboot, stop/start of all services) also restarts the audio HAL; it relies on the audio-rule repair.
Provided for authorized security research and education only. Do not use against devices you do not own or have explicit permission to test.
GPL-2.0-only — see LICENSE. The upstream 5.15 port
(woshigenm/CVE-2026-99491)
under upstream/CVE-2026-99491/ is distributed under the same license.