Skip to content

Commit 364b795

Browse files
authored
Merge pull request #1912 from HackTricks-wiki/update_Android_Application-Level_Virtualization__App_Clon_20260218_130254
Android Application-Level Virtualization (App Cloning) — How...
2 parents 479600f + 099a489 commit 364b795

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@
360360
- [Abusing Android Media Pipelines Image Parsers](mobile-pentesting/android-app-pentesting/abusing-android-media-pipelines-image-parsers.md)
361361
- [Accessibility Services Abuse](mobile-pentesting/android-app-pentesting/accessibility-services-abuse.md)
362362
- [Android Anti Instrumentation And Ssl Pinning Bypass](mobile-pentesting/android-app-pentesting/android-anti-instrumentation-and-ssl-pinning-bypass.md)
363+
- [Android Application Level Virtualization](mobile-pentesting/android-app-pentesting/android-application-level-virtualization.md)
363364
- [Android Applications Basics](mobile-pentesting/android-app-pentesting/android-applications-basics.md)
364365
- [Android Enterprise Work Profile Bypass](mobile-pentesting/android-app-pentesting/android-enterprise-work-profile-bypass.md)
365366
- [Android Hce Nfc Emv Relay Attacks](mobile-pentesting/android-app-pentesting/android-hce-nfc-emv-relay-attacks.md)

src/mobile-pentesting/android-app-pentesting/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Sometimes it is interesting to **modify the application code** to access **hidde
2727

2828
- [Spoofing your location in Play Store](spoofing-your-location-in-play-store.md)
2929
- [Play Integrity attestation spoofing (SafetyNet replacement)](play-integrity-attestation-bypass.md)
30+
- [Android app-level virtualization / app cloning abuse & detection](android-application-level-virtualization.md)
3031
- [Shizuku Privileged API (ADB-based non-root privileged access)](shizuku-privileged-api.md)
3132
- [Exploiting Insecure In-App Update Mechanisms](insecure-in-app-update-rce.md)
3233
- [Abusing Accessibility Services (Android RAT)](accessibility-services-abuse.md)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Android Application-Level Virtualization (App Cloning)
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
Application-level virtualization (aka app cloning/container frameworks such as DroidPlugin-class loaders) runs multiple APKs inside a single host app that controls lifecycle, class loading, storage, and permissions. Guests often execute inside the host UID, collapsing Android’s normal per-app isolation and making detection difficult because the system sees one process/UID.
6+
7+
## Baseline install/launch vs virtualized execution
8+
9+
- **Normal install**: Package Manager extracts APK → `/data/app/<rand>/com.pkg-<rand>/base.apk`, assigns a **unique UID**, and Zygote forks a process that loads `classes.dex`.
10+
- **Dex load primitive**: `DexFile.openDexFile()` delegates to `openDexFileNative()` using absolute paths; virtualization layers commonly hook/redirect this to load guest dex from host-controlled paths.
11+
- **Virtualized launch**: Host starts a process under **its UID**, loads the guest’s `base.apk`/dex with a custom loader, and exposes lifecycle callbacks via Java proxies. Guest storage API calls are remapped to host-controlled paths.
12+
13+
## Abuse patterns
14+
15+
- **Permission escalation via shared UID**: Guests run under the host UID and can inherit **all host-granted permissions** even if not declared in the guest manifest. Over-permissioned hosts (massive `AndroidManifest.xml`) become “permission umbrellas”.
16+
- **Stealthy code loading**: Host hooks `openDexFileNative`/class loaders to inject, replace, or instrument guest dex at runtime, bypassing static analysis.
17+
- **Malicious host vs malicious guest**:
18+
- *Evil host*: acts as dropper/executor, instruments/filters guest behavior, tampers with crashes.
19+
- *Evil guest*: abuses shared UID to reach other guests’ data, ptrace them, or leverage host permissions.
20+
21+
## Fingerprinting & detection
22+
23+
- **Multiple base.apk in one process**: A container often maps several APKs in the same PID.
24+
```bash
25+
adb shell "cat /proc/<pid>/maps | grep base.apk"
26+
# Suspicious: host base.apk + unrelated packages mapped together
27+
```
28+
- **Hooking/instrumentation artifacts**: Search for known libs (e.g., Frida) in maps and confirm on disk.
29+
```bash
30+
adb shell "cat /proc/<pid>/maps | grep frida"
31+
adb shell "file /data/app/..../lib/arm64/libfrida-gadget.so"
32+
```
33+
- **Crash-tamper probe**: Intentionally trigger an exception (e.g., NPE) and observe whether the process dies normally; hosts that intercept lifecycle/crash paths may swallow or rewrite crashes.
34+
35+
## Hardening notes
36+
37+
- **Server-side attestation**: Enforce sensitive operations behind [Play Integrity](play-integrity-attestation-bypass.md) tokens so only genuine installs (not dynamically loaded guests) are accepted server-side.
38+
- **Use stronger isolation**: For highly sensitive code, prefer **Android Virtualization Framework (AVF)**/TEE-backed execution instead of app-level containers that share a UID.
39+
40+
## References
41+
42+
- [Android Application-Level Virtualization (App Cloning) — How It Works, Abuse, and Detection](https://blog.azzahid.com/posts/android-app-virtualization/)
43+
44+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)