repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
firmware-level-zygote-backdoor-libandroid-runtime.mdMarkdown133 lines12.2 KiBsource raw download

title: "Firmware-level Android Backdoor via libandroidruntime Zygote Injection" section: "Mobile" sectionSlug: "mobile-pentesting" sourcePath: "src/mobile-pentesting/android-app-pentesting/firmware-level-zygote-backdoor-libandroid_runtime.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/mobile-pentesting/android-app-pentesting/firmware-level-zygote-backdoor-libandroid_runtime.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Firmware-level Android Backdoor via libandroid_runtime Zygote Injection#

Overview#

Supply-chain tampering of /system/lib[64]/libandroid_runtime.so can hijack android.util.Log.println_native so that every app forked from Zygote executes attacker code. The Keenadu backdoor adds a single call inside println_native that drives a native dropper. Because all app processes run this code, Android sandbox boundaries and per-app permissions are effectively bypassed.[1]

The same post-root execution model also appears in multi-stage Android rootkits delivered from apparently benign Play-distributed apps. In McAfee's Operation NoVoice analysis, the malware first landed in user space, obtained root with device-tailored exploits, and then replaced libandroid_runtime.so and libmedia_jni.so on the system partition so that every app spawned by zygote inherited the attacker hooks after reboot.[3]

Recent supply-chain patterns (2025+)#

Recent Triada-linked investigations show the same "infect Zygote once, reach every app" outcome being delivered through counterfeit/pre-infected firmware and, in some cases, through OTA-related system components instead of a purely post-sale root step.[4] Two practical consequences:

Pre-root staging: SDK init hijack + PNG tail polyglot#

Before the libandroid_runtime.so replacement, NoVoice used an app-level bootstrap that is worth recognizing during APK triage:[3]

Quick checks:

pngcheck -v suspicious.png
tail -c +1 suspicious.png | xxd | tail
binwalk -e suspicious.png

Hunting notes:

Dropper path: native patch → RC4 → DexClassLoader#

What changes on newer Android releases?#

Binder-based client/server backdoor#

C2 staging, crypto, and gating#

struct KeenaduPayload {
    int32_t  version;
    uint8_t  padding[0x100];
    uint8_t  salt[0x20];
    KeenaduChunk config;   // size + data
    KeenaduChunk payload;  // size + data
    KeenaduChunk signature;// size + data
} __packed;

Post-root persistence: wrapper libraries + framework patching + self-heal#

Once root is available, replacing libandroid_runtime.so is only one layer of persistence. NoVoice shows a more resilient pattern:[3]

Practical implications:

Persistence & forensic tips#

Quick rooted-device triage#

adb shell getprop ro.build.fingerprint
adb shell 'for f in /system/lib*/libandroid_runtime.so /system/lib*/libmedia_jni.so; do [ -e "$f" ] && sha256sum "$f"; done'
adb pull /system/lib64/libandroid_runtime.so . 2>/dev/null || adb pull /system/lib/libandroid_runtime.so .
strings -a libandroid_runtime.so | rg 'AK_CPP|com.action.SystemOptimizeService|com.action.SystemProtectService|vndx_10x|com.ak.test.Main'
adb shell logcat -d | rg 'AK_CPP|SystemOptimizeService|SystemProtectService'

If the firmware ships as super.img, extract the dynamic partitions first (simg2img when needed, then lpunpack) and diff the resulting system*.img contents against a trusted factory image.

References#