
Xperia 5II (SOG02/SO-52A), Xperia 1II (SOG01, SO-51A) CVE-2023-33107 + KernelSU late load
Warning
I am not responsible for any damage to your device.
KGSL UAF temporary-root exploit for the Sony Xperia 1 II / 5 II family
(SO-51A, SO51Aa, SO-52A, SOG01, SOG02 and XQ-AT42, XQ-AT51, XQ-AT52, XQ-AT72, XQ-AS42, XQ-AS52, XQ-AS62, XQ-AS72 global variants). It
patches the process credentials, flips SELinux permissive through the
forged thread.cpu_context switch-in, and can late-load a KernelSU LKM
plus its userspace.
| Project | Device | Firmware | Kernel |
|---|---|---|---|
sog02-58.2.C.3.127 | Sony Xperia 5 II (SOG02, KDDI) | 58.2.C.3.127 | 4.19.157-perf+ |
so-51a-58.2.B.0.520 | Sony Xperia 1 II (SO-51A, SO51Aa) | 58.2.B.0.520 | 4.19.157-perf+ |
so-52a-58.2.B.0.520 | Sony Xperia 5 II (SO-52A) | 58.2.B.0.520 | 4.19.157-perf+ |
sog01-58.2.C.5.10 | Sony Xperia 1 II (SOG01, KDDI) | 58.2.C.5.10 | 4.19.157-perf+ |
xq-at42-58.2.A.10.102 | Xperia 1 II (XQ-AT42) | 58.2.A.10.102 | 4.19.157-perf+ |
xq-at51-58.2.A.7.93 | Xperia 1 II (XQ-AT51) | 58.2.A.7.93 | 4.19.157-perf+ |
xq-at52-58.2.A.7.93 | Xperia 1 II (XQ-AT52) | 58.2.A.7.93 | 4.19.157-perf+ |
xq-at72-58.2.A.10.44A | Xperia 1 II (XQ-AT72) | 58.2.A.10.44A | 4.19.157-perf+ |
xq-as42-58.2.A.10.163 | Xperia 5 II (XQ-AS42) | 58.2.A.10.163 | 4.19.157-perf+ |
xq-as52-58.2.A.10.126 | Xperia 5 II (XQ-AS52) | 58.2.A.10.126 | 4.19.157-perf+ |
xq-as62-58.2.A.10.126 | Xperia 5 II (XQ-AS62) | 58.2.A.10.126 | 4.19.157-perf+ |
xq-as72-58.2.A.10.126 | Xperia 5 II (XQ-AS72) | 58.2.A.10.126 | 4.19.157-perf+ |
Official repositories:
sudo pacman -S --needed base-devel git curl unzip bc bison flex pahole \
android-tools python
vmlinux-to-elf is not in the official repositories; install it from the AUR:
paru -S vmlinux-to-elf
The NDK (android-ndk-r26d) and the kernel tree are fetched by
./build.sh --setup; no manual download is needed.
The app build needs a JDK, Gradle, and the Android SDK (platform 35 and
build-tools); the NDK comes from ./build.sh --setup.
sudo pacman -S --needed jdk-openjdk gradle
paru -S android-sdk # AUR; or use Google's cmdline-tools
export ANDROID_HOME=/opt/android-sdk
sdkmanager "platforms;android-35" "build-tools;36.0.0"
Then build the unified loader and the app together:
./build.sh -p unified --app --push
Build and push the exploit + LKM for your profile:
./build.sh -p <project> --push
Install the backslashxx/KernelSU manager. It is the only supported manager; the LKM is built from this fork.
Run the exploit:
adb shell /data/local/tmp/kgsl_root_su
By default the helper uses ./kernel_sony_sm8250 and ./android-ndk-r26d.
If your kernel source or NDK live elsewhere, point it at them:
./build.sh -p sog02-58.2.C.3.127 \
--kernel-dir /home/exer/kernelsrc \
--ndk /ndklocation
These flags override the defaults for the build; --setup still populates
the default ./kernel_sony_sm8250 and ./android-ndk-r26d.
The simplest path:
./build.sh # list the available targets
./build.sh -p sog02-58.2.C.3.127 # build exploit + LKM (no push)
./build.sh -p sog02-58.2.C.3.127 --push # build + push
./build.sh --detect --push --run # connected device: push + run
./build.sh --setup # fetch the NDK and kernel if missing
Profiles include SOG02, SO-51A, SO51Aa, SO-52A, SOG01 and XQ-AT42, XQ-AT51, XQ-AT52, XQ-AT72, XQ-AS42, XQ-AS52, XQ-AS62, XQ-AS72 (1 II/5 II) variants. Pushing is opt-in with
--push; the pushed files are verified by md5. --setup downloads
android-ndk-r26d and clones kernel_sony_sm8250 when they are missing;
--force --setup deletes and re-fetches both.
Manual equivalent:
make PROJECT=sog02-58.2.C.3.127 NDK_ROOT="$NDK"
tools/build_kernelsu_lkm.sh
adb push build/sog02-58.2.C.3.127/kgsl_root_su /data/local/tmp/kgsl_root_su
adb push build/sog02-58.2.C.3.127/kernelsu.ko /data/local/tmp/kernelsu.ko
adb shell 'chmod 755 /data/local/tmp/kgsl_root_su; \
/data/local/tmp/kgsl_root_su'
adb shell 'getenforce' # permissive at startup; KSU may enforce
adb shell 'cat /proc/modules | grep kernelsu' # kernelsu ... Live
A plain run loads /data/local/tmp/kernelsu.ko and runs
/data/adb/ksud late-load from the root child. INJECT_KO=0 and/or
LATE_LOAD=0 disable either half. POLICY_FIX=1 forces the exploit's
own SELinux policy reload while the late-load is enabled (normally skipped;
see the crash note below).
Root comes from the KernelSU userspace (manager / ksud su); the exploit
does not ship its own su client or daemon.
kgsl_map_user_mem runs on a second CPU and races the
overlap mmap. The exploit measures the ioctl duration, sweeps the
mmap delay over 0..that duration, and time-bounds the retry loop.
The freed object's pages are reclaimed by spraying children
(/proc/meminfo-derived sizes).task_struct/cred is located through the
reclaimed GPU mapping and patched to uid/gid 0 with full capability
sets; the root child verifies via /proc/<pid>/status.thread.cpu_context switch-in leaks KASLR
(__switch_to continuation), stores 0x01000000 into selinux_state
(enforcing=0), and replays the __switch_to epilogue. The root child
then writes /sys/fs/selinux/enforce so init and the property service
refresh their cached AVC state.src/ko_loader.c resolves the module's undefined symbols
from /proc/kallsyms, patches the symtab entries to SHN_ABS, and calls
init_module from the full-capability root child. The root child then
runs ksud late-load, which installs the userspace and initializes the
manager side.The manager's driver-fd handshake and detection belong to the KernelSU userspace; the exploit does not restart or relaunch it.
Permissive is only needed for the exploit startup. The forged-context
store writes selinux_state.enforcing = 0, and the root child writes
/sys/fs/selinux/enforce so init picks it up; the module load
(init_module) would be denied by the shell domain while enforcing, so
this happens before INJECT_KO.
KernelSU's LKM init then re-enables enforcing by design
(ksu.c: if (!!getenforce()) return; pr_info("Permissive SELinux, enforcing"); setenforce(true);). The exploit leaves that decision to
KernelSU, so getenforce may report Enforcing after a late-load run —
that is expected, not a failure. A second selinuxfs write would be denied
by the security:security setenforce check for the shell domain, so it is
not attempted.
The startup permissive fails only when the forged-context hijack did not
arm (permissive hijack not armed, implausible KASLR/context, or a GPU
write failure). The raw store never happens then, and the selinuxfs write
is denied; the exploit prints the reason.

Automatisiertes Framework für Sicherheitstests mobiler Anwendungen für Android, iOS und Windows. Führt statische und dynamische Analyse, Malware-Erkennung und API-Sicherheitstests mit CI/CD-Integration durch.

Kommandozeilen- und GUI-Tool zum Dekompilieren von Android-Dex- und APK-Dateien in lesbaren Java-Quellcode, mit Ressourcendekodierung, Entschleierung und Smali-Debugging-Funktionen.

Ein Werkzeug zum Reverse Engineering von Android-APK-Dateien.