Scalable online vetting of Android apps for measuring declared SDK versions and their consistency with API calls

Daoyuan Wu, Debin Gao, David Lo

This paper, published in Empirical Software Engineering, tackles the "Android Fragmentation" problem from a developer-configuration perspective. It explores how apps declare their compatibility with various Android versions and the risks that arise when these declarations don't match the actual code.

TL;DR

Researchers developed a lightweight, high-speed bytecode analysis tool to detect inconsistencies between an Android app’s declared SDK versions and its actual API calls. Analyzing over 22,000 popular apps, they found that 35% risk runtime crashes on older devices, while 2% remain vulnerable to remote code execution because they target outdated security models.

What Problem Does This Paper Address?

Android developers must manage compatibility using two main "Declared SDK" (DSDK) attributes in their manifest files:

  1. minSdkVersion: The oldest Android version the app can run on.
  2. targetSdkVersion: The version the app was designed for, which tells the OS whether to enable modern security and behavior changes.

The problem is twofold:

  • Compatibility Risk: If a developer sets minSdkVersion to 19 (Android 4.4) but calls an API introduced in version 21 (Android 5.0) without a safety check, the app will crash on older phones.
  • Security Risk: Android often introduces security patches that are only "active" if the app targets a recent SDK. Developers might intentionally or accidentally keep targetSdkVersion low to continue using "convenient" but insecure legacy APIs.

Existing tools to find these issues rely on "dataflow analysis," which tracks how data moves through a program. While accurate, these tools are incredibly slow (taking minutes per app) and often fail on large, modern apps. This makes them useless for "online vetting"—the process where an app store (like Google Play) checks an app the moment a developer uploads it.

Methods

The authors propose a lightweight bytecode search approach. Instead of building complex graphs of program logic, their tool operates directly on the original Android bytecode.

  • API-SDK Mapping: They parsed Android's official api-versions.xml to build a complete map of when every API was added, deprecated, or removed.
  • Fast Extraction: They used standard tools like aapt and dexdump to extract the manifest and bytecode without fully decompressing or "decoding" the app, saving significant time.
  • Safety Check Detection: To avoid false positives, the tool specifically looks for SDK_INT checks—the if statements developers use to say "only run this new code if the phone is running Android 10 or higher."
  • Library Filtering: The tool distinguishes between the app's own code and third-party libraries to help developers identify where the inconsistency actually lives.

Datasets

The study used a massive, modern dataset to ensure real-world relevance:

  • 22,687 Popular Apps: All apps had at least one million installs on Google Play.
  • Source: Apps were sourced via the AndroZoo repository.
  • Scale: The total dataset size was 570.8GB, with an average app size of 25MB—significantly larger than the "toy" apps used in many previous academic studies.

Key Insights and Ideas

  • The "Good Enough" Trade-off: The authors prove that for the specific task of SDK vetting, you don't need 100% perfect dataflow analysis. A fast, conservative bytecode search is "good enough" to catch the vast majority of issues while being fast enough for production use.
  • The Security Gap: A major "aha moment" is the realization that a low targetSdkVersion is a security "time machine." It forces a modern Android phone to revert to old, vulnerable behaviors to maintain compatibility with a lazy or uninformed developer's settings.
  • Third-Party Culprits: In many cases, the app developer isn't the one making the mistake. About half of the security vulnerabilities found were introduced by embedded third-party SDKs (like ad networks or analytics) that were themselves outdated.

Key Results

  • Speed: The approach is remarkably fast, requiring only ~5 seconds to process an app on average (median 4.75s).
  • Compatibility Issues: 35% of apps under-set their minSdkVersion, meaning they could potentially crash on older devices. However, because most users have upgraded their phones, only about 11.3% of apps would actually crash on a phone running Android 6.0 or newer.
  • Security Vulnerabilities: Roughly 2% of apps (484 popular apps) were found to be potentially exploitable by Remote Code Execution (RCE) because they called the dangerous addJavascriptInterface API while targeting an SDK version lower than 17.
  • Developer Trends: The "lag" between the minimum and target SDK is growing (median difference of 9 versions), showing that developers are struggling to keep up with Android's rapid evolution.

Limitations and Future Work

  • Static Analysis Hurdles: Like all static analysis, the tool can be fooled by Java reflection, dynamic code loading, or heavy code obfuscation (common in malware).
  • Upper Bound Results: Because the tool doesn't track the exact "flow" of execution, the results represent a "potential" risk (an upper bound) rather than a guaranteed crash.
  • Future Directions: The authors suggest integrating this tool directly into IDEs (like Android Studio) or app store submission pipelines to provide real-time feedback to developers before an app ever reaches a user's phone.

Summary updated

BibTeX
@inproceedings{wu2021scalable,
  author = {Daoyuan Wu and Debin Gao and David Lo},
  title = {{Scalable online vetting of Android apps for measuring declared SDK versions and their consistency with API calls}},
  booktitle = {Empir. Softw. Eng},
  year = {2021},
  url = {https://openreview.net/forum?id=wJhSUCRAr5},
}
Figure