Warning
Internal research code for one test device. It patches kernel memory, writes a kernel module, trips Knox, can brick the phone and void the warranty. Use it only on hardware you own and can afford to lose.
Temporary KernelSU root for the Samsung Galaxy A36 5G (SM-A366E) using
DirtyFrag (CVE-2026-43284). Tap one button, su starts working, no reboot and
no cable. It can also root on boot/unlock and re-apply the Knox Guard unlock.
Current release: v4.4.1-adb
- APK:
dfroot.apk - Version:
4.4.1-adb(versionCode 38), arm64 only - SHA-256:
496c6e16aaed66553c04fe3a080bc1182aa3b674c3c15867498c66c11afc34e3 - Signed with the v4.0 key, so it updates in place
- CI build/tests passed; this revision was not tested on hardware
- Galaxy A36 5G (
SM-A366E,a36xq) - Kernel
6.6.98-android15-8-33419078-abogkiA366EXXSBCZG3-4k - Firmware
A366EXXSBCZG3 - KernelSU Manager already installed
Other firmware or kernels are refused. The KO table is exact per Android release and kernel major.minor.
adb install -r dfroot.apkIf the old install uses a different signing key, uninstall it first. That wipes the app's private data.
- Open DFRoot.
- Tap Jailbreak and wait for the log to finish.
su -c idshould returnuid=0.- If KernelSU refuses the app, add DFRoot to its superuser list.
- Enable Auto-jailbreak on boot if you want boot/unlock retries and the keep service.
The app shows LIVE only when su actually answers. KernelSU still controls
the allowlist.
ADB trigger:
adb shell am broadcast -a df.root.action.ROOT -n df.root/.RootReceiver --receiver-foreground
adb logcat -s dfrootThe receiver requires android.permission.DUMP; ordinary apps cannot call it.
- The root supervisor restores
adb_enabledanddevelopment_settings_enabledevery 15 s. If Knox Guard, an MDM policy, or an accidental toggle turns USB debugging off, it comes back without a cable session. - The check only writes when the setting is not
1, so a healthy device is left alone. - The daemon is root-side, so it works when the app is force-stopped or the KG lock screen is up.
- CI build/tests passed; this revision was not tested on hardware.
KgWatchdog.forceFixunlocks on a SIMABSENTevent without waiting for the 10 minute periodic cooldown. It keeps a 30 second minimum gap and a two-per-ten-minute cap.- The KG pass disables
com.samsung.android.kgclient/.receiver.SimStateChangeReceiverbefore the TA call. The component is not inIntegritySeUtil's checked set, so the integrity path does not re-enable it. - A manifest
SimReceiverand a keep-service receiver both catch the protectedSIM_STATE_CHANGEDbroadcast; the keep tick also checksgsm.sim.stateas a fallback. - With the client SIM receiver disabled and the TA held at Completed, a missing tray cannot drive a SIM-control lock. A boot policy applied before root is live still needs the forced pass to recover.
- CI build/tests passed; this revision was not tested on hardware.
- Re-root no longer skips the supervisor repair:
runChainowns the chain claim, andPostRoot.repairwas rejecting that same caller beforelaunchScriptcould run. /dev/dfroot-statusnow carriessup_aliveandwatch_alivecomputed by the root publisher. The app no longer depends onstat(/proc/<other-pid>), which is unreliable for untrusted_app across SELinux builds.- Re-root logs
su,published,supandwatch, and succeeds only when the supervisor and watchdog both report alive. An incomplete keeper gets its own result message instead of a generic su failure.
- The primary button is available again while root is live and reads Re-root. It can be pressed repeatedly in one boot.
- A live run re-applies the mount-master overlay (and KG fix), upgrades the
root-side supervisor, waits for
/dev/dfroot-status, and probessu. It reportsRE-ROOT OKorRE-ROOT FAILEDin the log. - It does not rewrite
libc,libc++,crash_dump64orlibbinderdebug.sowhile they are live. The full DirtyFrag chain runs only whensuis dead and the one-shot/dev/dflatch is absent. - A held mutex with dead
suis stillneeds-reboot: the app cannot clear a root-owned tmpfs file without root, so that case still needs the supervisor to clear it or a reboot.
- Fixed the device-log blocker:
splicehelperread modes wrote to fd 0 while the parent listened on stdout (fd 1). The helper exited 0 and the parent read zero bytes, so patch #2 failed withread_vendor at 0x0 short read (4096). - A failed first read no longer "restores" uninitialized heap bytes into
libbinderdebug.so: the patcher reports how many original bytes were saved, and cleanup restores only those. - A pre-4.3.1 supervisor is now upgraded even when its legacy heartbeat is
fresh; the healthy fast path no longer skips
launchScriptforever and leaves every new status row unknown. - An Upgrade supervisor button appears when the root side is unpublished and su answers. It uses the same launch path as the keeper tick.
- The primary button is disabled while root is live, and
runChainre-probes beforeRunner.run, so a stale UI state cannot re-patch an already rooted kernel.
- The root-side card no longer reads root-owned
/data/dfroot,/data/adband/sys/modulefrom the app process: SELinux denies those paths to untrusted_app, so a healthy supervisor was displayed as absent and the heartbeat as stale. - The supervisor now publishes one atomic status line to
/dev/dfroot-status(tmpfs, mode 0644, restorecon'd) with the boot id, uptime heartbeat, supervisor and watchdog pids, scripts/module/mutex/su flags. - Unpublished state is
unknown, notabsent. Only/dev/dfis probed directly because it is readable; a held mutex is normal after the exploit runs. PostRoot.heartbeatFresh()uses the published status, so the keep tick no longer pays asulaunch every cycle just because it cannot read/data/dfroot/run/heartbeat.- An app update kills the old versioned supervisor and starts the new one, so the publisher actually changes on upgrade instead of leaving 4.3.0 running.
- Diagnostics includes the published flag and raw status line.
- Home shows the real chain state: rooted, needs-reboot, no-allowlist, stalled
or a retry countdown, read from the
root-stagefile the chain persists. - A root side card reports heartbeat age, supervisor, watchdog, kernel module, exploit mutex and boot scripts from the paths the supervisor publishes.
- The run card shows the live phase and an elapsed timer instead of an unlabelled progress bar; the last pass is a structured row (rc, duration, action).
- Root-side actions appear only when they apply: reboot (confirmed) on needs-reboot, manager deep link and copy-su on no-allowlist.
- The auto-root switch writes its intent to device-protected storage and the supervisor honours it, so toggling it off is no longer undone every 2 minutes.
- Bottom navigation replaces the FAB menu; whole-row toggles; status colour tokens in the theme; severity colouring and per-pass dividers in the log.
- Diagnostics export includes the chain state, root side, last Knox Guard
result and
sup.log.
- A failed stage no longer poisons the boot: the mutex
/dev/dfis released on every hard stage-2 failure,finit_module -EEXISTcounts as loaded, and stale/dev/dfm*markers from an earlier pass are ignored. - Each chunk is read once and reused for retries instead of recomputing IVs
against half-patched page cache;
crash_dump64andlibbinderdebug.soare restored after the chain. - The keep service runs in
:chainwith a file-locked chain claim, so the UI cannot start a second exploit over a boot pass. BootChainstopped holding a class monitor for minutes:tryLock, a bounded 60 s wait on a held mutex, explicitneeds-rebootandno-allowliststates, and a 30-minute backoff after six failures in one boot.- Root-side supervisor v2 re-enables its own components, clears a force-stopped
package, clears a poisoned mutex while
suis dead, and has an independentdfroot-watch.shrespawner. - The Knox Guard pass no longer blocks the keep tick.
- Native patching batches 4 KB page-cache chunks instead of forking
crash_dump64for every 16-byte block. - Stage 2 reports ksud exec success/failure through a pipe instead of a fixed wait.
- JNI validates keys, ICV length, port, socket type and paths.
- UI probes only while visible and reuses a fresh root heartbeat.
- The keep service stops when auto-root is off and root is dead.
- Logs rotate at 512 KB and render lazily.
- Native and Java metrics are included in diagnostics.
Requirements: JDK 21, Android SDK Platform 37, Build Tools 37, NDK
29.0.14206865 and CMake 3.22.1.
./create-keystore.sh
./gradlew :app:assembleReleaseFast internal build without R8 or resource shrinking:
./gradlew :app:assembleRelease -Pdfroot.minify=falseTests and artifact checks:
./gradlew :app:test
./tools/check-build.shCI runs the same steps on push, pull request or manual dispatch and uploads the
APK as an artifact. Tag releases need DFROOT_KEYSTORE_B64,
DFROOT_STORE_PASSWORD, DFROOT_KEY_ALIAS and DFROOT_KEY_PASSWORD in
repository secrets. Without them, publish the locally signed APK manually.
- Return code
0means ksud was launched, not that root is live. The app still probessu. - The stage-1 mutex is
/dev/df. A dead stage releases it before exiting, so a later pass in the same boot can retry;BootChainreportsneeds-rebootonly when su is dead and the mutex is still held. - Markers are compared by creation time, so
/dev/dfm*files from a previous pass do not look like results of the current one. - Never
rmmod kernelsu; it panics the kernel. - The Knox Guard TA unlock can write a one-way fuse. Treat it as irreversible.
- Patch KO images only with the Samsung DDK, and keep their provenance.
- This is not a portable root tool.
app/src/main/java/df/root/ app, service, state, UI and logs
app/src/main/jni/ exp.c, libc.S, libcxx.S, elf_parser.c, ko/
app/src/main/assets/ksud patched KernelSU userspace
app/src/main/assets/kgta_helper
tools/ helper source and artifact checks
dirtyfrag-lkm/ LKM source
Exploit work is not mine. Key upstream projects:
- diabl0w, DFRoot: https://github.com/diabl0w/DFRoot
- LSPosed, LSPromise: https://github.com/LSPosed/LSPromise
- polygraphene, DFReroot: https://github.com/polygraphene/DFReroot
- combeng6th, DirtyInit: https://github.com/combeng6th/DirtyInit
- tiann, KernelSU: https://github.com/tiann/KernelSU
- rushiranpise, Root My Galaxy Next: https://github.com/rushiranpise/Root-My-Galaxy-Next
- BuSung-dev, Root My Galaxy Payloads: https://github.com/BuSung-dev/Root-My-Galaxy-Payloads
- marin-m, vmlinux-to-elf: https://github.com/marin-m/vmlinux-to-elf
A36 port and Compose UI: @tsuchinaka
The A36 port, UI and service code are MIT (LICENSE). Bundled binaries and
upstream sources keep their own licenses; see NOTICE.md.