An Investigation into the Use of Common Libraries in Android Apps

Li Li, Tegawendé F. Bissyandé, Jacques Klein, Yves Le Traon

Abstract

Third-party libraries are ubiquitous in the Android ecosystem, providing essential functionality but complicating security analysis. This paper investigates the prevalence of these libraries and proposes a systematic method for their identification and removal. By analyzing 1.5 million applications, we identified 1,113 common libraries and 240 ad libraries. Our findings indicate that filtering these libraries significantly reduces "noise" in static analysis, leading to more accurate malware detection and more reliable app similarity measurements.

Introduction

The Android packaging model requires all necessary code, including third-party utilities and advertisement kits, to be bundled into a single .apk file. For security researchers, this creates a significant challenge: distinguishing between a developer's original code and the "noise" of common libraries. This lack of distinction leads to false positives in repackaging detection, noise in machine learning-based malware detection, and inefficient use of computational resources during static analysis. Tools like FlowDroid, for instance, often spend over half their resources analyzing library code irrelevant to an app's unique functionality.

Methodology

To address these challenges, we developed a three-step refinement process to harvest and confirm libraries from a large-scale dataset of 1.5 million Google Play apps.

The three-step library identification process: Candidate Extraction, Common Library Confirmation, and Ad Library Confirmation.
  1. Candidate Extraction: Package names were extracted and ranked by frequency, focusing on the first three segments (e.g., com.google.ads) while excluding internal Android framework packages.
  2. Common Library Confirmation: We performed pairwise similarity analysis to ensure package names represented stable libraries. By comparing code structures across different apps, we confirmed packages as libraries if the code remained identical or highly similar.
  3. Ad Library Identification: Potential ad libraries were identified through keyword matching and "feature investigation," checking for Internet permissions, specific UI components (View gadgets), and ad-related API calls.

Key Insights: The Impact of Libraries

Our analysis revealed that common libraries contribute an average of 41% of an Android app's code. In over 42% of sampled apps, library code actually outweighs original developer code. This prevalence creates a "similarity trap" for automated analysis tools.

Impact of common libraries on app similarity analysis, demonstrating potential False Positives and False Negatives.

As shown in Figure 1, two unrelated apps sharing a heavy library like Adobe Air can exhibit an 86% similarity score, leading to a false positive in repackaging detection. Conversely, differences in library inclusion can mask the similarity between related apps. Filtering these libraries allows researchers to focus on the unique logic of the application; in the Adobe Air example, filtering dropped the similarity of unrelated apps to 0%.

Furthermore, we observed a strong correlation between library usage and security status. Antivirus-flagged apps tend to use significantly more libraries (median of 3) than benign apps (median of 1), often due to "piggybacking" malicious payloads onto legitimate apps or including heavy ad-related "grayware."

Results

The resulting whitelists of 1,113 common libraries and 240 ad libraries provide a valuable resource for the research community. By excluding these identified libraries, the accuracy of a Random Forest malware classifier improved from 81.85% to 83.10%. Additionally, our ad library set achieved 82% completeness in identifying adware based on VirusTotal tags. Among the findings, com.google.ads emerged as the most pervasive library, appearing in nearly 17% of all analyzed apps.

Conclusion and Future Work

While our approach effectively filters a vast amount of library noise, challenges remain regarding code obfuscation and library versioning. Future research will explore SDK API methods that are resilient to obfuscation, ensuring that libraries can be identified even when developers attempt to hide their presence. The whitelists generated by this study are available on GitHub to support further research into Android security.

Summary updated

BibTeX
@inproceedings{li2016investigation,
  author = {Li Li and Tegawendé F. Bissyandé and Jacques Klein and Yves Le Traon},
  title = {{An Investigation into the Use of Common Libraries in Android Apps}},
  booktitle = {SANER},
  year = {2016},
  url = {https://openreview.net/forum?id=renuMphXec},
}
Figure