Skip to content

About

A little DFRoot for the A36 5G

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DFRoot A36

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

Requirements

  • 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.

Install

adb install -r dfroot.apk

If the old install uses a different signing key, uninstall it first. That wipes the app's private data.

Use

  1. Open DFRoot.
  2. Tap Jailbreak and wait for the log to finish.
  3. su -c id should return uid=0.
  4. If KernelSU refuses the app, add DFRoot to its superuser list.
  5. 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 dfroot

The receiver requires android.permission.DUMP; ordinary apps cannot call it.

What changed in 4.4.1

  • The root supervisor restores adb_enabled and development_settings_enabled every 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.

What changed in 4.4.0

  • KgWatchdog.forceFix unlocks on a SIM ABSENT event 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.SimStateChangeReceiver before the TA call. The component is not in IntegritySeUtil's checked set, so the integrity path does not re-enable it.
  • A manifest SimReceiver and a keep-service receiver both catch the protected SIM_STATE_CHANGED broadcast; the keep tick also checks gsm.sim.state as 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.

What changed in 4.3.4

  • Re-root no longer skips the supervisor repair: runChain owns the chain claim, and PostRoot.repair was rejecting that same caller before launchScript could run.
  • /dev/dfroot-status now carries sup_alive and watch_alive computed by the root publisher. The app no longer depends on stat(/proc/<other-pid>), which is unreliable for untrusted_app across SELinux builds.
  • Re-root logs su, published, sup and watch, 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.

What changed in 4.3.3

  • 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 probes su. It reports RE-ROOT OK or RE-ROOT FAILED in the log.
  • It does not rewrite libc, libc++, crash_dump64 or libbinderdebug.so while they are live. The full DirtyFrag chain runs only when su is dead and the one-shot /dev/df latch is absent.
  • A held mutex with dead su is still needs-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.

What changed in 4.3.2

  • Fixed the device-log blocker: splicehelper read 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 with read_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 launchScript forever 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 runChain re-probes before Runner.run, so a stale UI state cannot re-patch an already rooted kernel.

What changed in 4.3.1

  • The root-side card no longer reads root-owned /data/dfroot, /data/adb and /sys/module from 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, not absent. Only /dev/df is 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 a su launch 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.

What changed in 4.3

  • Home shows the real chain state: rooted, needs-reboot, no-allowlist, stalled or a retry countdown, read from the root-stage file 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.

What changed in 4.2

  • A failed stage no longer poisons the boot: the mutex /dev/df is released on every hard stage-2 failure, finit_module -EEXIST counts 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_dump64 and libbinderdebug.so are restored after the chain.
  • The keep service runs in :chain with a file-locked chain claim, so the UI cannot start a second exploit over a boot pass.
  • BootChain stopped holding a class monitor for minutes: tryLock, a bounded 60 s wait on a held mutex, explicit needs-reboot and no-allowlist states, 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 su is dead, and has an independent dfroot-watch.sh respawner.
  • The Knox Guard pass no longer blocks the keep tick.

What changed in 4.1

  • Native patching batches 4 KB page-cache chunks instead of forking crash_dump64 for 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.

Build

Requirements: JDK 21, Android SDK Platform 37, Build Tools 37, NDK 29.0.14206865 and CMake 3.22.1.

./create-keystore.sh
./gradlew :app:assembleRelease

Fast internal build without R8 or resource shrinking:

./gradlew :app:assembleRelease -Pdfroot.minify=false

Tests and artifact checks:

./gradlew :app:test
./tools/check-build.sh

CI 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.

Notes

  • Return code 0 means ksud was launched, not that root is live. The app still probes su.
  • The stage-1 mutex is /dev/df. A dead stage releases it before exiting, so a later pass in the same boot can retry; BootChain reports needs-reboot only 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.

Project layout

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

Credits

Exploit work is not mine. Key upstream projects:

A36 port and Compose UI: @tsuchinaka

License

The A36 port, UI and service code are MIT (LICENSE). Bundled binaries and upstream sources keep their own licenses; see NOTICE.md.

About

A little DFRoot for the A36 5G

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages