>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Java

How to Run Xposed Modules Without Root Access Using NPatch

When you need to poke around someone else's Android app, bypass SSL pinning, or enable hidden debugging, the usual instinct is to reach for Magisk or KernelSU. But rooting a daily-driver phone just for one utility is inconvenient. Banking clients start complaining, Play Integrity breaks, and on corporate devices root is outright forbidden by security policies.

For a long time this problem was solved by the LSPatch project. It took a ready APK, embedded a LSPosed runtime and the necessary hooks inside, after which the app would run with Xposed modules without system privileges. When the original LSPatch stopped being actively maintained, a fork called NPatch (Neo LSPatch) stepped in to fill the gap.

Star History Chart

What this tool does

The project takes a regular APK file and repackages it. Inside the archive it injects the loader's DEX files and native libraries (.so) responsible for intercepting ART (Android Runtime) calls. When the patched app launches, this embedded layer starts first. It initializes the Xposed API execution environment right inside the isolated app process.

To the rest of the system, you're just running a regular user program. It doesn't need superuser rights, doesn't touch the system partition /system, and doesn't try to replace zygote. All modifications and hooks are confined strictly within the sandbox of that specific package.

Versions starting from Android 9 up to current Android releases compatible with the JingMatrix/LSPosed codebase are supported.

How the patching process works

Under the hood, NPatch builds on the work of several open-source projects:

  • LSPosed handles Xposed API calls and runtime method interception in ART.
  • Xpatch provided the core concept of injecting code into an APK without system intervention.
  • Apkzlib is used for unpacking, modifying the zip archive, and quickly repackaging without full decompilation to smali.

Unlike the classic apktool + jarsigner combo, where decompiling large obfuscated projects often crashes with errors, this approach is faster and more reliable. Resources and manifest are adjusted directly, after which the loader is injected.

Usage options

You can work with the tool in two ways: on a computer via terminal or directly on your phone.

Option 1. Console via jar

If you're automating test build assembly on CI or analyzing software on a workstation, it's more convenient to grab the ready-made jar file from releases:

# Базовый синтаксис запуска утилиты
java -jar npatch.jar [аргументы]

The utility takes the source APK and modules to embed as input. The output is a ready modified package that only needs to be signed with a test key and installed via adb install.

Option 2. Device manager

For everyday tasks it's simpler to download manager.apk from the releases section on GitHub.

  1. Install the manager on your Android device.
  2. Select an installed app or a local APK file.
  3. Specify the Xposed modules that should load on startup.
  4. The manager builds a new install package and suggests removing the original before installing the modification.

Since the app signature inevitably changes during repackaging, you won't be able to update the original program over it. You'll need to remove it, losing local data if it wasn't synced.

Practical use cases

I regularly use these patchers in reverse engineering and mobile client testing.

  • Bypassing SSL Pinning for traffic interception. Wrapping traffic in Burp Suite or mitmproxy is much simpler when you can embed a module like TrustMeAlready or JustTrustMe directly into the APK. No need to push certificates into the system store via Magisk.
  • Instrumentation and log collection. If you need to see what arguments are being passed to private methods in a third-party SDK, you write a tiny Xposed hook, inject it into the build, and log the call stack to logcat.
  • Testing modules on clean devices. Module developers find it useful to check how their code behaves in isolation without system LSPosed.

Caveats and limitations

The rootless approach has natural boundaries you should know about upfront:

  • System modules won't work. If a hook is designed to change the behavior of SystemUI, notification shades, or Android services, NPatch is powerless here. It lives strictly inside the user process.
  • Some apps with strict anti-cheat or advanced self-protection (signature integrity checks, detection of foreign .so files) will detect the tampering and exit on startup.
  • The documentation in the repository is still sparse. Most details are discussed in the project's Telegram chat, and fresh builds often need to be pulled directly from GitHub Actions artifacts.

Is it worth trying

If you periodically need to dig under the hood of a third-party Android app or quickly test a hypothesis without reflashing your device, add npatch.jar to your toolbox. The project keeps the LSPatch codebase up to date and handles repackaging apps for newer Android versions without issues.

Related projects