TL;DR
Researchers from the University of Luxembourg have developed a systematic approach to identify and "filter out" common third-party libraries from Android apps. By analyzing 1.5 million APKs, they produced a comprehensive whitelist of 1,113 common libraries and 240 ad libraries, demonstrating that excluding this "noise" significantly improves the accuracy of malware and repackaging detection.
What Problem Does This Paper Address?
The Android packaging model requires every piece of code needed for an app to run—including third-party utilities and advertisement kits—to be bundled into a single .apk file. This creates a major headache for security researchers.
When performing static analysis (examining code without running it), tools often can't distinguish between the developer's original logic and the "noise" of common libraries. This leads to three main issues:
- False Positives in Repackaging Detection: Two completely different apps might look 80% identical simply because they both use the same heavy-duty graphics or ad library.
- Noise in Malware Detection: Machine learning models might accidentally learn to associate a perfectly benign ad library with malware if that library happens to be popular among malicious developers.
- Wasted Resources: Analysis tools like FlowDroid spend over half their CPU time and memory analyzing library code that is irrelevant to the app’s unique functionality.
Methods
The authors proposed a three-step refinement process to harvest and confirm libraries:
- Candidate Extraction: They extracted package names from 1.5 million apps and ranked them by frequency. To keep the list manageable, they focused on the first three segments of a package name (e.g.,
com.google.ads) and excluded internal Android framework packages. - Common Library Confirmation: To ensure a package name actually represented a stable library rather than just a common naming convention or obfuscated code, they performed pairwise similarity analysis. They compared the code structure of packages with the same name across different apps. If the code remained identical or highly similar across different apps, it was confirmed as a library.
- Ad Library Identification: They used a combination of keyword matching (looking for "ad" in names while filtering out common English words like "adapter") and "feature investigation." The latter involved checking if the package required Internet permissions, used specific UI "View" gadgets, or called ad-related APIs.
Datasets
- The Primary Dataset: Approximately 1.5 million Android apps crawled from the official Google Play store.
- Ground Truth for Security: The authors submitted all 1.5 million apps to VirusTotal, using the aggregate reports from 40+ antivirus engines to label apps as "benign" or "antivirus-flagged."
- The Output: The study resulted in two whitelists: one containing 1,113 common libraries and another with 240 confirmed ad libraries. These are available on GitHub.
Key Insights and Ideas
- The "41% Rule": On average, 41% of an Android app's code is contributed by common libraries. In over 42% of the sampled apps, there was actually more library code than original developer code.
- Malware Loves Libraries: Antivirus-flagged apps use significantly more libraries (median of 3) compared to benign apps (median of 1). This is often because malicious apps are "piggybacked" (legitimate apps injected with malicious payloads) or are ad-heavy "grayware."
- The Similarity Trap: Without filtering, two unrelated apps using the same Adobe Air library showed an 86% similarity score (a False Positive for repackaging). After filtering the libraries, the similarity dropped to 0%.
- Precision Matters: The authors found that using a "loose" whitelist (one with many potential false positives) actually decreased the accuracy of malware detection. A highly precise, manually refined whitelist is necessary for the best results.
Key Results
- Improved Malware Detection: By excluding the 1,113 identified libraries, the accuracy of a Random Forest malware classifier improved from 81.85% to 83.10%. While this seems small, it represents a significant reduction in noise for large-scale triage.
- Ad Library Completeness: Their harvested ad library set was able to correctly identify apps as "adware" (based on VirusTotal tags) with 82% completeness, outperforming previous smaller whitelists.
- Library Popularity:
com.google.adswas the most pervasive library, appearing in nearly 17% of all apps in the 1.5 million app dataset.
Limitations and Future Work
The authors acknowledge a few hurdles:
- Obfuscation: Their current approach struggles with libraries that have been heavily obfuscated (renamed to random characters like
a.b.c), as this breaks the package-name-based harvesting. - Versioning: The study does not explicitly account for different versions of the same library, which can vary in code structure.
- Manual Refinement: The final "precise" ad library list (AD240) still required a stage of manual verification to ensure high accuracy, which is difficult to scale as the ecosystem evolves.
Future work aims to investigate "SDK API methods"—calls that are resilient to obfuscation—to better identify libraries even when developers try to hide them.
Summary updated