Skip to main content
Be Bitwise

Android Malware Analysis

Mobile Malware Analysis · Mobile Advanced Security track

10 min read

In this module

Static Triage: The First Five Minutes

A fresh Android sample lands on your workstation. Don't reach for the decompiler yet. Reach for manifest analysis. AndroidManifest.xml is the single most informative artefact for initial triage — it declares the app's entire capability set before you've read a line of code.

Manifest Analysis

After extracting the APK (which is a ZIP archive), decode the binary XML manifest using apktool or aapt2:

bash
# Decode APK with apktool
$ apktool d suspicious_app.apk -o output_dir/
# The decoded manifest is in output_dir/AndroidManifest.xml
# Key elements to examine:
# - <uses-permission> tags
# - <receiver> tags (especially with BOOT_COMPLETED)
# - <service> tags (especially with BIND_ACCESSIBILITY_SERVICE)
# - <activity> tags with exported="true"
# - <provider> tags

Permission Red Flags

Certain permission combinations all but shout malicious intent:

PermissionLegitimate UseMalicious Use
RECEIVE_SMS / READ_SMSMessaging appsOTP interception for banking trojans
BIND_ACCESSIBILITY_SERVICEAssistive toolsUI monitoring, keylogging, overlay attacks
SYSTEM_ALERT_WINDOWChat heads, PiPPhishing overlays
REQUEST_INSTALL_PACKAGESApp storesDropper installing additional malware
RECEIVE_BOOT_COMPLETEDAlarm appsPersistence across reboots
BIND_DEVICE_ADMINMDM appsPreventing uninstallation

A flashlight app requesting RECEIVE_SMS, BIND_ACCESSIBILITY_SERVICE, and RECEIVE_BOOT_COMPLETED is almost certainly malicious.

Manifest-First Triage

AndroidManifest.xml hands you a full declaration of the app's capabilities before you touch any code. Permissions, exported components, intent filters, receivers, and services lay out the attack surface in plain text. With practice, most Android malware families can be classified from the manifest alone — no decompiler required.

Identifying Malicious Patterns

Accessibility Service Abuse

Accessibility services were built to help users with disabilities. Malware turns them into a swiss army knife: monitoring the foreground app, scraping screen content, faking gestures, intercepting notifications, and stonewalling removal attempts.

In the decompiled code, hunt for classes that extend AccessibilityService and look at their onAccessibilityEvent handler. The event types the service subscribes to in its XML configuration tell you what it's actually doing.

Overlay Attacks

Overlay attacks use either SYSTEM_ALERT_WINDOW or accessibility service overlays. The choreography goes:

  1. The malware watches the foreground app via accessibility or UsageStatsManager.
  2. A targeted app (banking, crypto wallet) lands in the foreground.
  3. The malware fires an activity styled to look like the target app's login screen, painted directly on top of it.
  4. Credentials typed into the overlay sail off to the C2 server.
  5. The overlay quietly dismisses itself, and the real app takes over as if nothing happened.

The sequence puts the two views side by side. The left-hand column is all the user ever sees; everything else happens behind the bank's own login screen.

SMS Interception

Banking trojans steal SMS one-time passwords. The technique has evolved through Android's SMS lockdowns:

  • Pre-Android 4.4: SMS_RECEIVED was an ordered broadcast, so any app holding RECEIVE_SMS with a high enough priority could read a message and abort the broadcast, hiding it from the user.
  • Android 4.4 onwards: Only the user's default SMS app gets the SMS_DELIVER broadcast and can write to the SMS store, and aborting SMS_RECEIVED no longer hides anything. Any app with RECEIVE_SMS can still read incoming messages, so OTP theft carried on; hiding the evidence got harder.
  • 2019 onwards: Google Play policy restricted SMS and call log permissions to apps acting as the default handler. That's a store rule, not an OS one, so sideloaded malware can still ask for RECEIVE_SMS. Plenty of families adapted anyway and now read SMS OTP codes straight out of notification content via the accessibility service or a notification listener. That in turn is why Android 13's restricted settings block accessibility and notification-listener access for sideloaded apps until the user overrides it by hand, and why Play Protect's on-device live threat detection watches for apps abusing those permissions.

Dynamic Analysis

Static analysis tells you what the app says it can do. Dynamic analysis tells you what it actually does.

Emulator Setup

Android emulators give you a controlled environment to detonate malware in. Plenty of families know that, and ship emulator detection:

  • Sniffing for known emulator properties (ro.hardware=goldfish, ro.product.model=sdk).
  • Probing for missing telephony hardware (no SIM, no IMEI).
  • Looking for analysis-tool fingerprints (Frida, Xposed, root binaries).
  • Watching the clock — emulators often tick a little oddly.

Analysts respond with hardened emulators that spoof hardware properties, or physical test devices kitted out with the monitoring tools you actually need.

Network Monitoring

Network traffic exposes the C2, the data being lifted, and the protocol on the wire:

  • mitmproxy / Burp Suite: Intercept HTTPS by installing a trusted CA on the analysis device. Certificate pinning, where it exists, has to be bypassed first.
  • tcpdump / Wireshark: Capture everything on the wire for full protocol analysis.
  • DNS monitoring: Log DNS queries to spot C2 domains, DGA patterns, and DNS tunnelling.

Frida for Runtime Instrumentation

Frida is the workhorse of dynamic Android analysis. It injects a JavaScript engine into the target process, and from there you can hook any Java method, inspect arguments and return values, change behaviour mid-call, and trace execution flow live.

Typical Frida moves on a malware sample:

  • Decrypting strings at runtime: Hook the decryption function and log the plaintext.
  • Bypassing certificate pinning: Stub out the certificate validation so your proxy stays in the loop.
  • Tracing accessibility service events: Watch exactly what the malware is reading off the screen.
  • Intercepting C2 communication: Hook the network APIs before encryption to capture plaintext payloads.
  • Defeating anti-analysis checks: Hook the detection routines and make them return whatever the malware wants to hear.
Obfuscation and Anti-Analysis

Obfuscation is the default state of any halfway-serious mobile malware. Expect string encryption (C2 addresses encrypted with AES or XOR and decrypted at runtime), class and method name mangling (ProGuard or custom obfuscators), control-flow noise (opaque predicates, dead code), and native-code migration (the spicy logic moved from Java into .so libraries). The cure is dynamic analysis — when the binary actually runs, the decrypted strings and real behaviour have nowhere to hide.

Banking Trojan Analysis: Overlay Mechanism

The overlay attack is the signature move of modern Android banking trojans. Pull it apart and you get the target list, the credential-exfil method, and the C2 protocol all at once.

Target List

Trojans carry a list of package names they care about. When the accessibility service spots one in the foreground, the overlay fires. The list typically lives hardcoded in the APK, downloaded from C2 for dynamic updates, or stashed in encrypted shared preferences.

Web Injection Templates

The fake login screen is usually an HTML/CSS page rendered in a WebView. These web injects ship from the C2, tailored to each targeted bank. To add a new bank, the operator just uploads a new template — no binary update required.

Key Concept
Accessibility Service Abuse

Android accessibility services are the Swiss Army knife of banking trojans. Originally designed to assist users with disabilities, they provide the ability to monitor all UI events (foreground app detection for overlay timing), read all screen content (credential harvesting), perform gestures programmatically (automating fraudulent transactions), intercept notifications (capturing SMS OTPs without the SMS permission), and resist removal (detecting navigation to the uninstall screen and pressing back automatically). Google has tightened Play Store review for apps requesting this permission, but sideloaded malware faces no such restriction.

Case Study: Joker/Bread Malware Family

Joker (a.k.a. Bread) is the most prolific malware family ever to camp on the Google Play Store. By January 2020 Google said it had removed about 1,700 unique Bread apps from Play, most before anyone downloaded them, and researchers kept finding new Joker apps on the store for years after. The monetisation play: toll fraud, quietly subscribing victims to premium services through WAP billing.

Evasion Techniques

Joker's longevity on Play comes down to four habits:

  • Staged payloads: The Play Store APK is clean. The payload is downloaded post-install.
  • Dynamic class loading: Malicious classes are pulled from encrypted DEX files stashed in assets or fetched from C2.
  • String encryption: C2 URLs, package names, and other tells stay encrypted until runtime.
  • Versioning: Benign builds get submitted first, ride out a few clean scans, then quietly graduate to the malicious payload.

String encryption in families like Joker is rarely clever. Once you've found the decode helper in JADX, porting it to a few lines of your own and running it over every byte array in the sample usually takes minutes, and the output is the shortlist of IOCs you were after:

Try itBefore running, guess what kind of string each array hides. Then change the 7 in decode to 8 and see how quickly a wrong guess turns to noise.
C (GCC 9.2.0)

Subscription Fraud Mechanism

Joker automates the WAP billing flow end-to-end:

  1. Identify the user's mobile carrier.
  2. Navigate (via a hidden WebView, usually) to a premium subscription page.
  3. Intercept the carrier's confirmation SMS carrying the verification PIN.
  4. Punch the PIN into the subscription form automatically.
  5. Delete the confirmation SMS so nothing visible is left behind.

The user finds out when the phone bill turns up.

Automated Analysis Tools

MobSF (Mobile Security Framework)

MobSF is an open-source automated mobile-app security testing framework. On Android it extracts and parses the manifest, decompiles the APK, scans for hardcoded secrets and suspicious API usage, runs the app in an emulator, watches the network, and stitches the lot together into one security report.

VirusTotal

VirusTotal aggregates results from 70+ antivirus engines. Drop an APK hash in and you get detection rates, known C2 domains, and community comments. The Android-specific bits include manifest parsing, permission listings, and certificate information.

Sandboxes

Automated sandboxes run the APK inside an instrumented Android emulator or device while recording API calls, network traffic, filesystem changes, and behavioural patterns. You'll see Cuckoo Droid in older write-ups, but it's been unmaintained for years. Maintained options include MobSF's own dynamic analyser, and hosted services such as Hatching Triage and Joe Sandbox.

The Analysis Environment Arms Race

Authors and analysts have been in an arms race for years. Malware learns to spot the lab; analysts build labs that look more like real phones. Malware sniffs for Frida; analysts ship stealthier instrumentation. The takeaway is that no single technique holds up forever. A solid analysis pipeline weaves together static analysis (immune to environment detection), dynamic analysis on realistic physical devices, network capture, and automated sandbox runs.