# DFRoot local root chain (extracted)

Source APK: `star.apk`
SHA-256: `09bc07ee27e9c5d5ddc16ddcdb48a697e130a162def2c3dd34a9cf8c954b9115`

## 8 embedded LKMs (`02_lkm/`)

| vermagic | inferred KMI |
|---|---|
| `5.10.252-dirty` | `android12-5.10` |
| `5.10.245` | `android13-5.10` |
| `5.15.202-android13-5.15.202_r00-dirty` | `android13-5.15` |
| `5.15.202-dirty` | `android14-5.15` |
| `6.1.166-dirty` | `android14-6.1` |
| `6.6.127-4k-g46a034eca005-dirty` | `android15-6.6` |
| `6.12.76-4k` | `android16-6.12` |
| `6.18.32-4k-g47cc22554442-dirty` | `android17-6.18` |

All modules: `name=dfroot`, `description=DFRoot LKM`, `license=GPL`,
`scmversion=g1decad1df4d5-dirty`.

## Local exploit

- `03_exploit/libdfroot.so` — executed as PIE by `ExploitRunner.runLocked()`,
  contains the 8 LKMs + `embedded_stage2.elf`.
- `03_exploit/embedded_stage2.elf` — ET_EXEC stage embedded inside `libdfroot.so`
  (KMI selection, SELinux/OPPO patching, system-library patching, bootstrap launch).
- `03_exploit/libbootstrap.so` — staged as `bootstrap`; requires uid/euid 0 and
  execs the staged `daemon`.

Invocation contract (from `ExploitRunner.runLocked`):

```
libdfroot.so --encap-port <port> --sender-port <port> --spi <spi> --aes-key <hex>
```

The Java layer creates the IPsec context:

```
IpSecManager.openUdpEncapsulationSocket()
IpSecManager.allocateSecurityParameterIndex(127.0.0.1)
IpSecAlgorithm("cbc(aes)", key)
IpSecTransform.Builder.setIpv4Encapsulation(socket, localPort)
IpSecTransform.Builder.buildTransportModeTransform(...)
```

## Root daemon

- `04_daemon/librootdaemon.so` -> staged as `daemon`
- `04_daemon/libdfagent.so` -> `dfagent.so`
- `04_daemon/libtrust_launcher.so` -> `trust-launcher.so`
- socket: `/data/local/tmp/.dfroot-runtime/files/daemon.sock`
- protocol: `DFROOT_DAEMON/1` (`STATUS`, `UPDATE`, `EXPORT`, `STOP`)
- modules: `SHELL_EXEC`, `TRUST_RECOVER`, `WALLET_COLLECT`

## Agents (`05_agents/`)

- `remote-agent.dex` — VirtualDisplay/MediaCodec capture, input injection, UI password scan.
- `inject-agent.dex` — password-field hooks for imToken / MetaMask.
- `trust-recovery.dex` — Trust Wallet mnemonic/private-key extraction.

## Notes

- Root is local: no remote shellcode issuance. `bcmshak.top` is used for
  reporting/session/module C2, not for root.
- Native exploit only supports GKI KMI in the table above; patched kernels
  fail with `DEVICE NOT VULNERABLE`, non-GKI with `SYSTEM_UNSUPPORTED`.
