Status: Implemented and tested

Root Access & Privileged Diagnostics

In Android systems, "root" refers to executing commands under Linux superuser (UID 0) privileges. Voodoo Hardware Info treats root as an strictly optional investigative tool—never a requirement.

Why Checking for a "su" Binary Alone Is Insufficient

Many naive utilities simply check if /system/bin/su exists on disk and report the device as "Rooted." In modern Android, this is frequently incorrect: the binary may have broken permissions, root access may be disabled by the superuser manager (e.g. Magisk or KernelSU), or the app sandbox may be restricted by SELinux. Voodoo conducts a safe, non-invasive runtime verification test executing a harmless id probe to verify whether UID 0 execution is genuinely authorized.

Security Boundary: What Root Does and Does Not Guarantee
  • What Root Can Reveal: Protected kernel sysfs nodes (raw battery current registers, GPU clock frequencies, raw partition tables) inaccessible to unprivileged apps.
  • What Root Does NOT Guarantee: Root cannot bypass hardware-enforced write locks, restore blown Knox / eFuse counters, read physically absent sensors, or circumvent hardware encryption without keys.
  • Zero Security Bypasses: Voodoo Hardware Info does not provide instructions, scripts, or tools to root devices or defeat platform security.

How Voodoo Handles Privileged Diagnostics

1. Primary Call & Fallback Chain

Extracted from RootAccessCollector.kt and SuShellManager.kt. The app first checks known binary paths, then executes a sandboxed allowlisted command with strict timeouts and concurrent stream draining to prevent pipe deadlocks:

// Excerpt from com.tool3.hardwareinfo.core.shell.SuShellManager.kt
val binaryExists = SU_PATHS.any { path -> File(path).exists() }

if (binaryExists) {
    // Execute harmless probe with 3000ms timeout
    val result = execute("id", timeoutMs = 3000)
    val isRootGranted = result.success && result.stdout.contains("uid=0")
} else {
    // Unrooted devices report cleanly without prompting the user
}

2. Strict Command Allowlist (ShellAllowlist)

Under project safety rules, arbitrary shell commands cannot be executed through Voodoo. All commands must match an immutable, read-only allowlist (ShellAllowlist.kt):

  • Permitted: id, getprop [key], cat /sys/class/... (read-only sysfs nodes).
  • Strictly Prohibited: Any command containing shell chaining (&&, ;), pipes (|), redirections (>), or write operations (rm, chmod, mount).

3. Interpretation & Normalization Logic

  • Exit Status Verification: An exit code of 0 with stdout matching uid=0(root) confirms active root privileges.
  • Report Labeling: In both plain text and JSON exports, any metric retrieved via root is explicitly tagged with requires_root: true and provenance ROOT_SHELL.

4. Availability-State Triggers

  • On unrooted devices, all privileged queries return AvailabilityState.ROOT_REQUIRED without throwing unhandled exceptions.
  • If a su prompt times out or the user denies access in Magisk/KernelSU, marked AvailabilityState.PERMISSION_DENIED.

Subsystem Field Inventory

Field ID Display Name Type Primary Source / API Requires Root
root.is_rooted Root Access State STRING SuShellManager probe ("Rooted (UID 0)" / "Not Rooted") No (Safe Probe)
root.su_binary_path SU Binary Location STRING Filesystem scan of allowlisted binary paths No
root.identity_probe Identity Probe (id) STRING su -c id (verifies uid=0 gid=0) Yes
root.allowlist_enforced Command Allowlist BOOLEAN ShellAllowlist security validation No