Understanding Android Obfuscation Techniques: A Large-Scale Investigation in the Wild

XiaoFeng Wang, Shuaike Dong, Menghao Li, Wenrui Diao, Xiangyu Liu, Jian Liu, Zhou Li, Fenghao Xu, Kai Chen, Xiaofeng Wang 0006, Kehuan Zhang

TL;DR

This paper presents a large-scale "in the wild" investigation of how Android obfuscation is actually used across official markets, third-party stores, and malware repositories. By analyzing over 114,000 apps, the researchers discovered that while basic techniques like identifier renaming are pervasive in third-party markets to fight piracy, advanced techniques like string encryption remain a strong indicator of malicious intent.

What Problem Does This Paper Address?

Android applications are primarily written in Java, which is notoriously easy to decompile into readable source code. To protect intellectual property and hide malicious logic, developers use obfuscation—techniques that make code difficult for humans and analysis tools to understand without changing its functionality.

While many researchers have studied how to obfuscate or how to break obfuscation, there was a significant gap in understanding how these techniques are deployed in the real world. Do legitimate developers use the same tools as malware authors? Does the app market (e.g., Google Play vs. a third-party Chinese market) influence the level of protection? This paper aims to provide a holistic view of the obfuscation landscape to help researchers build better analysis tools and help developers choose the right protection strategies.

Methods

The authors developed a lightweight detection framework to identify four major obfuscation categories:

  1. Identifier Renaming: Replaces meaningful names (like getPassword) with meaningless strings (like a or IllIIl). The authors used an N-gram based machine learning model (SVM) to detect the "abnormal" distribution of characters that occurs when names are mangled.
  2. String Encryption: Hides sensitive strings (URLs, hardcoded keys) in encrypted blocks that are decrypted at runtime. They used a similar N-gram ML approach, trained on open-source apps from F-Droid that were intentionally obfuscated with commercial tools.
  3. Java Reflection: Allows code to call functions dynamically by name, which often "breaks" static analysis tools. The researchers used signature matching to find reflection patterns and backward slicing (tracing data flow in reverse) to identify what functions were actually being called.
  4. Packing: Encapsulates the entire original APK inside a "wrapper" that decrypts and loads the code only when the app runs. They identified this using heuristic features (like the presence of specific "stub" classes) and signatures from popular commercial packing services like Qihoo and Tencent.

Datasets

The study utilized a massive dataset of 114,560 APKs (totaling ~1.5 TB) collected in 2016 and 2017:

  • Official Market: 26,614 apps from Google Play.
  • Third-party Markets: 65,666 apps from six popular Chinese markets (e.g., Wandoujia, Huawei, Xiaomi).
  • Malware: 22,280 samples from VirusShare and VirusTotal.
  • Ground Truth: Open-source apps from F-Droid were used to train the machine learning models.

Key Insights and Ideas

  • The Piracy Driver: Identifier renaming is significantly more common in third-party markets (73%) than in Google Play (43%). This is likely because third-party markets suffer from rampant app cloning and piracy, forcing developers to use every tool available to protect their code.
  • Malware's "Script Kiddie" Gap: Surprisingly, over one-third of malware samples used no identifier renaming. The authors attribute this to "script kiddies" who lack the skill to use obfuscators, or "false alarmed" malware where a malicious library is simply bundled into a non-obfuscated benign app.
  • String Encryption is a Red Flag: String encryption is almost non-existent in benign apps (0.0% in Google Play) but appears in over 5% of malware. If an app encrypts its strings, there is a high statistical probability it is hiding something malicious.
  • Reflection is Universal but Different: About 50% of all apps (benign and malicious) use reflection. However, legitimate apps use it for backward compatibility or accessing hidden system APIs, while malware uses it to hide calls to sensitive functions like the SMS Manager.

Key Results

  • Renaming Prevalence: 43% (Google Play), 73% (3rd-party), 63.5% (Malware).
  • String Encryption Prevalence: 0% (Google Play), 0.1% (3rd-party), 5.3% (Malware).
  • Packing Prevalence: 0% (Google Play), 10.4% (3rd-party), 2.1% (Malware).
  • Model Accuracy: The identifier renaming detector achieved a 0% false positive rate on 1,000 original apps and a 0.6% false negative rate. The string encryption model achieved a 98.5% success rate.
  • Reflection Recovery: Using backward slicing, the authors successfully recovered the target of reflective calls in 65.7% of Google Play apps, but only 27.1% in malware, indicating that malware authors use much more complex, multi-stage reflection patterns.

Limitations and Future Work

The authors noted two main areas for future exploration:

  • Control-Flow Obfuscation: This technique (which scrambles the logic flow of a program) was found to be non-universal and difficult to cluster into a large enough sample size for this specific study.
  • Native Code Obfuscation: The study focused on Java-level obfuscation. Obfuscation within C/C++ code (via the Android NDK) requires a different set of analysis skills and was left as a topic for future research.

Summary updated

BibTeX
@inproceedings{wang2018understanding,
  author = {XiaoFeng Wang and Shuaike Dong and Menghao Li and Wenrui Diao and Xiangyu Liu and Jian Liu and Zhou Li and Fenghao Xu and Kai Chen and Xiaofeng Wang and Kehuan Zhang},
  title = {{Understanding Android Obfuscation Techniques: A Large-Scale Investigation in the Wild}},
  booktitle = {Securecomm},
  year = {2018},
  doi = {10.1007/978-3-030-01701-9\_10},
}
Figure