An advanced, ptrace-less shared library injector for modern ARM64 Android systems (Android 10 - 16).
This tool utilizes eBPF to precisely capture the Zygote fork specialization of an Android application, and seamlessly forces the process to load a custom Agent payload (.so) using an in-memory "Executable Cave Trampoline"—bypassing standard debugging and memory integrity SDKs.
- 100% Ptrace-Free: Never uses
ptraceor theTracerPid. Undetectable by standard debugger checks. - Cave Scrubber: Actively destroys the residual memory footprint of the injection payload after execution to defeat in-memory scanners.
- Dynamic ELF Parsing: Natively parses
libelfon-device to defeat ASLR and Android OS versioning of thedlopensymbol. No hardcoded offsets. - App Context Support: Instantly intercepts target package strings (e.g.
com.fatalsec.fatalpay). No manual UID lookup required.
The injector requires Android's vmlinux header and specifically targets the aarch64 architecture. We provide two ways to compile it depending on your host OS.
- vmlinux: You must place your target Android device's
vmlinuxfile (which contains the BTF info) in the root of this repository. Since/sys/kernel/btfis not directly accessible via standard adb, use this workaround:adb shell "su -c 'cat /sys/kernel/btf/vmlinux' > /data/local/tmp/vmlinux" adb pull /data/local/tmp/vmlinux .
- bpftool: If building via Docker (Option B), the script expects a static
bpftoolbinary for x86_64 in the root directory asbpftool_bin.# Download a static bpftool binary if you don't have one curl -L https://github.com/libbpf/bpftool/releases/download/v7.4.0/bpftool-v7.4.0-amd64.tar.gz | tar -xz && mv bpftool bpftool_bin
If you are running Ubuntu/Debian natively, you can compile the project instantly without Docker.
- Install dependencies:
sudo apt install clang llvm gcc-aarch64-linux-gnu libc6-dev-arm64-cross libelf-dev zlib1g-dev libbpf-dev - Run Make:
make
If you are on macOS or Windows and do not want to configure a cross-compilation toolchain, you can use our Docker wrapper. It automatically spins up an isolated Ubuntu container and runs the Makefile inside it.
- Ensure Docker Desktop is running.
- Execute the wrapper:
./build.sh
Note
Agent Payloads: A sample agent (libstealth_agent.so) is included in the agent/ directory for testing purposes. If you already have your own shared library that you want to inject, there is no need to compile the sample agent.
- Push the compiled injector and your custom agent payload (
.so) to the device:
adb push injector /data/local/tmp/
adb push libstealth_agent.so /data/local/tmp/
adb shell "chmod +x /data/local/tmp/injector"- Run the injector as root, passing the target application package name and the payload path:
adb shell "su -c '/data/local/tmp/injector com.example.targetapp /data/local/tmp/libstealth_agent.so'"- Launch the target app on your phone. The eBPF kernel script will instantly catch the launch, inject the payload, scrub the memory, and the injector will securely terminate itself.
./injector com.fatalsec.fatalpay /data/local/tmp/libstealth_agent.so <
[*] eBPF /proc/mem Stealth Injector Started
[*] Target App: com.fatalsec.fatalpay (UID 10343)
[*] Payload: /data/local/tmp/libstealth_agent.so
[+] Attached. Waiting for target launch...
[+] Target Captured: PID 20214
[+] Dynamically resolved dlopen in /apex/com.android.runtime/lib64/bionic/libdl.so at offset 0x4020
[+] Hijacked IP 0x75b55b454c to Cave 0x75b55c85c0. Waking app...
[+] Injection complete signal from PID 20214.
[+] Original instruction restored at 0x75b55b454c.
[*] Resuming target for seamless continuation. Cave scrubbed!
[*] Injection complete. Shutting down gracefully.