Adversaries may use Android’s Native Development Kit (NDK) to write native functions that can achieve execution of binaries or functions. Like system calls on a traditional desktop operating system, native code achieves execution on a lower level than normal Android SDK calls.
The NDK allows developers to write native code in C or C++ that is compiled directly to machine code, avoiding all intermediate languages and steps in compilation that higher level languages, like Java, typically have. The Java Native Interface (JNI) is the component that allows Java functions in the Android app to call functions in a native library.[1]
Adversaries may also choose to use native functions to execute malicious code since native actions are typically much more difficult to analyze than standard, non-native behaviors.[2]
| ID | Name | Description |
|---|---|---|
| S0540 | Asacub | |
| S0432 | Bread |
Bread has used native code in an attempt to disguise malicious functionality.[4] |
| S0529 | CarbonSteal |
CarbonSteal has seen native libraries used in some reported samples [5] |
| S1083 | Chameleon |
Chameleon has used the KeyguardManager API to evaluate the device’s locking mechanism and the AlarmManager API to schedule tasks.[6] |
| S0555 | CHEMISTGAMES |
CHEMISTGAMES has utilized native code to decrypt its malicious payload.[7] |
| S9005 | DocSwap |
DocSwap has decrypted the encrypted APK file security.dat using the |
| S1231 | GodFather |
GodFather has hooked onto the |
| S0544 | HenBox | |
| S1185 | LightSpy |
LightSpy's main executable and modules use native libraries to execute targeted functionality.[11][12][13][14] |
| C0054 | Operation Triangulation |
During Operation Triangulation, the threat actors use the Audio Queue API to record audio.[15][16] |
| S0545 | TERRACOTTA |
TERRACOTTA has included native modules.[17] |
This type of attack technique cannot be easily mitigated with preventive controls since it is based on the abuse of system features.
| ID | Name | Analytic ID | Analytic Description |
|---|---|---|---|
| DET0717 | Detection of Native API | AN1847 |
For Android, detect Native API from documented management, network, or vetting evidence; treat state queries as periodic observations rather than real-time events. Correlate Application Permission via Android Enterprise DPC / Application Vetting [DevicePolicyManager.getPermissionGrantState(); PackageManager manifest/requested-permission review]; Application State via Android Enterprise / EMM [Managed package inventory/status and package metadata]; OS API Execution via Application Vetting / Instrumented Dynamic Analysis [Dynamic API/runtime trace: App loads native library (.so) or resolves JNI bridge NOT IN $ApprovedNativeLibraries$ immediately before suspicious lower-level activity (sensor access, file write, network connection) — native code loading before anomalous activity is the]. Alert on a sequence or state change inconsistent with the device/app baseline, approved management policy, or expected user workflow; do not infer unobserved API calls, file/process activity, or payload content from management state alone. |