# matisse-public — Redmi K50 Pro (MT6983) / kernel 5.10.209 Privilege Escalation and KernelSU Loading
> **English TL;DR** — A fully documented, from-scratch writeup + toolkit for obtaining `uid=0` with a
> kernel SID on a **Redmi K50 Pro (matisse, MediaTek MT6983, kernel 5.10.209)** and loading **KernelSU via
> LKM late-load**, without unlocking the bootloader. Full source is published on purpose: a root tool you
> cannot audit is a root tool you should not trust.
---
## Why Full Source Code is Published
This repository performs **privilege escalation**. Any closed-source tool claiming to "give you root" should be questioned:
it could equally do other things without your knowledge or verification. Therefore we **proactively publish all source code, log formats, failure cases, and reproduction steps**, including:
- Complete exploit source code (`payload_src/`) — you can read line-by-line, compile yourself, and compare hashes
- All scripts and criteria (`tools/`, `ksu_persist.sh`) — including **failed attempts**
- Real kernel panic excerpts (`evidence/`) — proving the crashes we encountered and their root causes
- Build recipes and artifact hashes (`payload_src/mt87_build/BUILD_INFO.txt`, `SHA256SUMS`) — for your verification
- Clear **applicability boundaries and disclaimers** (see below)
**Does not include**: any device identifiers (serial numbers / MAC addresses), personal data. Third-party derived code sources and licenses are **listed in [`NOTICE.md`](NOTICE.md) and [`payload_src/PROVENANCE.md`](payload_src/PROVENANCE.md)**.
---
## Results (Auditable)
| Item | Verified Evidence |
|---|---|
| `uid=0` | `su -c id` → `uid=0(root) gid=0(root) groups=0(root)` |
| **kernel SID** | Same line: `context=u:r:ksu:s0` |
| **KernelSU loaded** | `/proc/modules` → `kernelsu … - Live` |
| Loader logs | `/data/local/tmp/ksu_go.log` → `uid=0` / `load_policy rc=0` / `late-load rc=0` / `modules: 1` |
| Device stable | Same `boot_id` throughout, `uptime` increases continuously |
Complete battle report: [WIN_20261003_1620_uid0_kernelsu.md](WIN_20261003_1620_uid0_kernelsu.md)
> **Verification**: Artifact hashes for released materials are in [`SHA256SUMS`](SHA256SUMS); exploit build recipe and expected sha256 in
> [`payload_src/mt87_build/BUILD_INFO.txt`](payload_src/mt87_build/BUILD_INFO.txt). If you distrust any binary, compile from source only.
---
## What It Does (High Level)
1. **Round R**: Perform heap layout on `pselect`'s `fd_set`, combined with dangling `pi_blocked_on` after `rt_waiter` release,
triggering `rt_mutex_adjust_prio_chain` walk to reach a controlled write (`task->real_cred`).
2. **Round E5**: Zero out SELinux enforcing flag (Android-style `enforcing-8` write) to enter Permissive mode.
3. **Round C**: Write `task->cred` (true `uid=0` + kernel SID).
4. **gate branch** (key patch in this repo): At the **exact moment of obtaining `uid=0`**,
`system("sh /data/local/tmp/ksu_go.sh &")` — use the official userspace loader for KernelSU late-load.