diff --git a/README.md b/README.md
index 7a527380..8f9f633f 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@

DirtyFrag
Root without unlocking. Gone after reboot.
An ephemeral Android root utility powered by CVE-2026-43284.
- Built for Samsung devices, with a One UI-inspired interface, KernelSU integration,
+ Built for Samsung devices, with a One UI-inspired interface, KernelSU / APatch integration,
and no custom kernel or unlocked bootloader required on vulnerable devices.
-
+
@@ -24,7 +24,7 @@ Compatibility depends on the device's kernel and security patches. Root is **eph
## Install
1. Install the DirtyFrag APK from [Releases](https://github.com/mitschud/DirtyFrag/releases/latest).
-2. Install an SU manager that **ships `libksud.so`**:
+2. Install an SU manager that **ships `libksud.so` or `libapd.so`**:
- Samsung - **required**:
- [diabl0w's KernelSU](https://github.com/diabl0w/KernelSU/releases)
- Other:
@@ -32,12 +32,13 @@ Compatibility depends on the device's kernel and security patches. Root is **eph
- [KernelSU-Next](https://github.com/KernelSU-Next/KernelSU-Next/releases/latest)
- [KowSU](https://github.com/KOWX712/KernelSU/releases/latest)
- [BakaSU](https://github.com/Baka-SU/BakaSU/releases/latest) (formerly ReSukiSU)
+ - [APatch](https://github.com/bmax121/APatch/releases) (jailbreak / `late-load` build)
3. Open DirtyFrag, pick your manager in the **SU Manager** card, then press **Run exploit**.
> [!WARNING]
> Since 1.10 (upstream 3.2) DirtyFrag no longer bundles `ksud` - it is staged from the selected
-> manager's own `libksud.so`. A manager that does not ship that library cannot give you root. The
-> older advice to install a CI / Actions build of the manager no longer applies.
+> manager's own `libksud.so` (or `libapd.so` for APatch). A manager that does not ship that library
+> cannot give you root. The older advice to install a CI / Actions build of the manager no longer applies.
> [!NOTE]
> Pre-release builds of `master` are not published to Releases. Take the **`DFRoot`** artifact of the
@@ -61,7 +62,7 @@ again after every reinstall.
- **Autorun** (start on boot), gated behind Expert mode, with a failed-run interlock that disables
itself after a failed attempt so a bad run cannot boot-loop you
- **Auto reboot** (soft reboot) - since 1.11 (upstream 4.1) this works with every KernelSU
- derivative: `dfroot.ko` is unloaded after late-load and ksud's own `soft-reboot` is run
+ derivative and APatch: `dfroot.ko` is unloaded after late-load and the manager daemon's own `soft-reboot` is run
- **KernelSU Modules** on/off - works without root, applied by the kernel module before ksud starts
- RO Partition Protection
- Advanced log, with one tap to save it to Downloads
@@ -114,7 +115,7 @@ re-run a "slow" run, the daemon may still be working.
**Q: How do I remove root cleanly?**
-A: Before unrooting, use file manager with root and delete /data/adb/ksu, ksud, module residue.
+A: Before unrooting, use file manager with root and delete `/data/adb/ksu`, `ksud` (or `/data/adb/ap`, `apd`), and module residue.
## Building
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1b60136d..55013fcc 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -11,6 +11,7 @@
the Play policy lint that flags this broad permission does not apply. -->
+
0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ showSuManagerPopup();
+ }
+ }
+ }
+
+ /** One candidate: an app that actually ships libksud.so or libapd.so. */
private static final class SuManagerEntry {
final String packageName;
final CharSequence label;
@@ -1312,16 +1343,15 @@ private static final class SuManagerEntry {
}
}
- /** Every installed app carrying libksud.so in its native lib dir - exactly
- * the set ExploitRunner.stageAssets() can use, so anything listed here is
- * guaranteed to pass the runtime check too. */
+ /** Every installed app carrying libksud.so or libapd.so in its native lib dir -
+ * exactly the set ExploitRunner.stageAssets() can use, so anything listed here
+ * is guaranteed to pass the runtime check too. */
private List scanSuManagers() {
List out = new ArrayList<>();
PackageManager pm = getPackageManager();
for (ApplicationInfo ai : pm.getInstalledApplications(0)) {
if (ai.packageName.equals(getPackageName())) continue;
- if (ai.nativeLibraryDir == null) continue;
- if (!new File(ai.nativeLibraryDir, "libksud.so").exists()) continue;
+ if (!ExploitRunner.hasKsud(ai)) continue;
out.add(new SuManagerEntry(ai.packageName, pm.getApplicationLabel(ai)));
}
out.sort((a, b) -> a.label.toString().compareToIgnoreCase(b.label.toString()));
@@ -1355,6 +1385,10 @@ private void loadSuManagerPref() {
/** OneUI-style rounded popup list over the dim overlay - same look and feel
* as the overflow menu, so the picker does not look like a stock spinner. */
private void showSuManagerPopup() {
+ if (!hasAppListPermission()) {
+ requestPermissions(new String[]{PERM_GET_INSTALLED_APPS}, REQ_GET_INSTALLED_APPS);
+ return;
+ }
float md = getResources().getDisplayMetrics().density;
List apps = scanSuManagers();
final android.widget.PopupWindow[] pwRef = {null};
diff --git a/app/src/main/jni/bootstrap.c b/app/src/main/jni/bootstrap.c
index 216bb4b7..7125130d 100644
--- a/app/src/main/jni/bootstrap.c
+++ b/app/src/main/jni/bootstrap.c
@@ -12,6 +12,7 @@
#define BLKROSET 0x125d
#define KSUD_STAGE "/data/user_de/0/df.root/ksud"
#define KSUD "/data/adb/ksud"
+#define APD "/data/adb/apd"
#define PREFS_PATH "/data/user_de/0/df.root/shared_prefs/dfroot.xml"
#define MODULES_DIR "/data/adb/modules"
@@ -140,7 +141,7 @@ static int late_load_running(void)
buf[n] = '\0';
for (int i = 0; i < n; i++)
if (!buf[i]) buf[i] = ' ';
- if (strstr(buf, "ksud") && strstr(buf, "late-load")) {
+ if ((strstr(buf, "ksud") || strstr(buf, "apd")) && strstr(buf, "late-load")) {
found = 1;
break;
}
@@ -231,12 +232,16 @@ int main(void)
}
}
- touch("/dev/dfm5");
+ touch("/dev/dfm5");
if (run_ctx(NULL, (char *[]){ KSUD_STAGE, "late-load", "--package-name", su_manager, NULL }) == 0) {
touch("/dev/dfm6");
if (soft_reboot) {
while (late_load_running()) sleep(1);
- run_ctx("u:r:ksu:s0", (char *[]){ KSUD, "soft-reboot", NULL });
+ const char *daemon = access(KSUD, X_OK) == 0 ? KSUD
+ : access(APD, X_OK) == 0 ? APD
+ : KSUD_STAGE;
+ run_ctx(daemon == KSUD ? "u:r:ksu:s0" : NULL,
+ (char *[]){ (char *)daemon, "soft-reboot", NULL });
}
} else {
touch("/dev/dfme2");
diff --git a/app/src/main/res/values-b+zh+Hans/strings.xml b/app/src/main/res/values-b+zh+Hans/strings.xml
index 027ef557..93b5a349 100644
--- a/app/src/main/res/values-b+zh+Hans/strings.xml
+++ b/app/src/main/res/values-b+zh+Hans/strings.xml
@@ -13,7 +13,7 @@
Root 管理器
请选择管理器
%1$s(%2$s)
- 未找到包含 libksud.so 的应用
+ 未找到包含 libksud.so 或 libapd.so 的应用
选择
开机自动提权
开机自动提权(需专家模式)
@@ -21,7 +21,7 @@
自动软重启
自动软重启(需专家模式)
提权成功后执行软重启
- KernelSU 模块
+ 系统模块
已启用,下次提权时加载模块
已禁用,下次提权时跳过模块
显示高级日志
@@ -88,7 +88,7 @@
请选择一个日志缓冲区大小,再重试。
尚未选择 Root 管理器
%1$s 已卸载
- 在 %1$s 中找不到 libksud.so
+ 在 %1$s 中找不到 libksud.so 或 libapd.so
修补检查显示设备不受此漏洞影响
异常:%1$s
读取应用设置失败
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f8e82b93..0b2671dc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -15,7 +15,7 @@
SU Manager
Not selected - required
"%1$s (%2$s)"
- No app with libksud.so found
+ No app with libksud.so or libapd.so found
Select
Autorun
Autorun (Expert)
@@ -90,7 +90,7 @@
Change it to any other value and retry.
no SU manager selected
%1$s is no longer installed
- libksud.so not found in %1$s
+ libksud.so / libapd.so not found in %1$s
patch: DEVICE NOT VULNERABLE
exception: %1$s
READING PREFS FAILED
diff --git a/gradlew.bat b/gradlew.bat
index 8508ef68..a51ec4f5 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,82 +1,82 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-@rem SPDX-License-Identifier: Apache-2.0
-@rem
-
-@if "%DEBUG%"=="" @echo off
-@rem ##########################################################################
-@rem
-@rem gradlew startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables, and ensure extensions are enabled
-setlocal EnableExtensions
-
-set DIRNAME=%~dp0
-if "%DIRNAME%"=="" set DIRNAME=.
-@rem This is normally unused
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if %ERRORLEVEL% equ 0 goto execute
-
-echo. 1>&2
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
-
-"%COMSPEC%" /c exit 1
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo. 1>&2
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
-
-"%COMSPEC%" /c exit 1
-
-:execute
-@rem Setup the command line
-
-
-
-@rem Execute gradlew
-@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
-@rem which allows us to clear the local environment before executing the java command
-endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
-
-:exitWithErrorLevel
-@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
-"%COMSPEC%" /c exit %ERRORLEVEL%
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem gradlew startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables, and ensure extensions are enabled
+setlocal EnableExtensions
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+"%COMSPEC%" /c exit 1
+
+:execute
+@rem Setup the command line
+
+
+
+@rem Execute gradlew
+@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
+@rem which allows us to clear the local environment before executing the java command
+endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
+
+:exitWithErrorLevel
+@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
+"%COMSPEC%" /c exit %ERRORLEVEL%