Skip to main content
mali-pagecache-root
Visual Studio Code IntelliJ IDEA
Name
Last commit
Last update
docs exploit kernel scripts .gitignore LICENSE PROVENANCE.md README.md
TCL 50C721 rooting toolkit
Autonomous root exploit and hardening APK for untethered, boot-persistent root on one TCL Android TV firmware. Gains root silently on every boot, applies ad blocking and firewall rules, then re-enforces SELinux — no manual intervention after initial sideload. This is firmware-specific research and tooling, not a universal TCL root tool or a supported installer.
Tested scope
Item
Value
TV
TCL QLED 50C721 / BeyondTV6
Firmware
V8-R51MT02-LF1V903, build AR10
Android / kernel
Android 11 / 4.14.198+
SoC / GPU
Realtek RTD1319 / Mali-G31 (Bifrost, kbase r28p0)
Userspace
32-bit ARMv7
Security patch
2024-03-05
Test result
3 consecutive autonomous boots verified (including cold power-cycle)
SELinux post-root
Enforcing (re-locked after hardening)
Only this model/firmware combination has been tested. See compatibility limits.
What it does
Autonomous boot chain (AutoRoot APK)
The APK installs once via ADB sideload and gains root automatically on every subsequent boot:
LOCKED_BOOT arm — BootReceiver starts the native binary immediately on LOCKED_BOOT_COMPLETED. The binary injects 114-byte Thumb-2 shellcode into libc's __cxa_atexit via CVE-2022-22706 (Mali GPU page-cache write). TCL's TGuard kills the Java parent within ~10 seconds — the native exits without restoring (fire-and-forget mode).
Natural trigger (~T+22s) — rtkm_aiaq (Realtek AI process with rtkmem write+execute permission) starts and loads the armed libc page. The shellcode maps physical address 0x1DE7000 via /dev/rtkmem and writes selinux_state.enforcing = 0.
Rescue job (T+60s) — A scheduled rescue JobService detects SELinux is Permissive, starts a fresh native process, which:
Restores the original 420-byte __cxa_atexit body (safe for all processes)
Walks the kernel task_struct list via /dev/rtkmem physical memory
Finds its own task by comm[] match + PID verification at offset +0x3E0
Overwrites credentials with root from init_cred (runtime capability template, handles 38-bit cap width)
Clears seccomp filter and TIF_SECCOMP thread flag
Escapes TGuard's cgroup kill zone (migrates 7 cgroup controllers)
Hardening — With uid=0 and cgroup escape:
Bind-mounts ad-blocking hosts file to /etc/hosts
Drops iptables rules blocking telemetry IPs
Disables 28 bloatware packages
Re-enforces SELinux to Enforcing
Writes completion marker to /data/local/tmp/.autoroot_done
The device ends up with Enforcing SELinux, unmodified system files, and all hardening applied — indistinguishable from stock on inspection.
TGuard bypass
TCL's TGuard has a two-phase kill mechanism:
Phase 1 (T+5–30s): adj=250 dependency-scan kill — kills unauthorized app processes
Phase 2 (T+30–120s): adj=905 memory-manager kill — cleans up survivors
The fire-and-forget approach defeats both phases: the native arms the shellcode and exits immediately when TGuard kills its parent (detected via stdin EOF). The shellcode persists in the dirty page cache and triggers naturally when rtkm_aiaq starts ~12 seconds later.
Standalone stages (legacy tethered root)
The two standalone programs (root_cve22706.c, libc_rtkmem_patch2.c) implement the same CVE-2022-22706 page-cache write primitive as separate manual stages, useful for ADB tethered rooting.
Scripts
scripts/root.sh — ADB automation for manual tethered root.
scripts/post_root.sh — Post-root hook: creates device backups (APKs, app data, WiFi, settings), auto-prunes to 5 most recent.
Included
Technical writeup: full chain details, TGuard analysis, kernel offsets, and failure history.
Native source and build notes: autonomous root + two standalone stages.
APK source and build: complete Java project for the boot-persistent APK wrapper.
Compatibility limits: what must be established before considering another device.
Recovery notes: model-specific USB recovery and warnings.
Kernel source excerpt: supporting analysis, not a build dependency.
Quick start
Option A: Autonomous APK (recommended)
# Build native payload
cd exploit && make && cd ..
# Build APK (requires Android SDK command-line tools + JDK 17)
# See scripts/autoroot/ for full build instructions
SDK_ROOT="/path/to/android-sdk"
ANDROID_JAR="$SDK_ROOT/platforms/android-28/android.jar"
BT="$SDK_ROOT/build-tools/34.0.0"
# Compile Java → DEX → APK → sign
javac -source 8 -target 8 -bootclasspath "$ANDROID_JAR" \
-d build/classes scripts/autoroot/src/com/local/autoroot/*.java
cd build/classes && find . -name "*.class" | xargs "$BT/d8" --min-api 21 --output ../ && cd ../..
"$BT/aapt" package -f -M scripts/autoroot/AndroidManifest.xml -I "$ANDROID_JAR" -F build/unsigned.apk
cd build && "$BT/aapt" add unsigned.apk classes.dex && cd ..
mkdir -p build/lib/armeabi-v7a && cp exploit/bin/auto_root build/lib/armeabi-v7a/libauto_root.so
cd build && "$BT/aapt" add unsigned.apk lib/armeabi-v7a/libauto_root.so && cd ..
"$BT/zipalign" -f 4 build/unsigned.apk build/aligned.apk
"$BT/apksigner" sign --ks ~/.android/debug.keystore --ks-pass pass:android \
--out build/autoroot.apk build/aligned.apk
# Install and prepare
adb connect <TV_IP>:5555
adb install build/autoroot.apk
adb shell pm enable com.local.autoroot
adb shell cmd appops set com.local.autoroot APP_AUTO_START allow
adb shell am broadcast -a com.local.autoroot.PREPARE_NEXT_BOOT \
-n com.local.autoroot/.PrepareReceiver
# Reboot — root happens automatically
adb reboot
# Verify (after 4 minutes)
adb shell 'getenforce; head -1 /etc/hosts; cat /data/local/tmp/.autoroot_done'
Option B: Manual tethered root
cd exploit && make
adb connect <TV_IP>:5555
adb push bin/auto_root /data/local/tmp/
adb shell /data/local/tmp/auto_root
Before considering use
Use only on hardware you own or are explicitly authorized to assess. Review all C files and every firmware-specific assumption first. Preserve data and obtain a known matching recovery image and procedure independently. Do not expose ADB to an untrusted network. The APK re-exploits on every boot; rebooting without the APK returns to stock (volatile patches cleared, package disables persist).
Do not flash patched boot or vbmeta images based on this project. Two historical attempts bootlooped; USB firmware recovery was required.
License
The original toolkit code and documentation are MIT-licensed. The separately
licensed kernel source reference is GPL-2.0, with its
original notices and license text. It is included for analysis
only: it is not compiled or linked into the toolkit. See LICENSE and
provenance for the component boundary and pinned upstream link.
Texto de gitlab.com tal como lo publicó, leído de su página y mostrado aquí con el formato de El Autómata. El original, en gitlab.com · Volver a la noticia de El Autómata