TL;DR
Identifying the exact version of a third-party library (TPL) in an Android app is crucial for security auditing, but code obfuscation usually gets in the way. This paper introduces SAD, a novel detection tool that uses class structural similarity and semantic summaries to pinpoint TPL versions even in heavily obfuscated apps. By evaluating apps with a new, stricter metric, the authors demonstrate that SAD outperforms existing state-of-the-art tools by over 10% in version-level accuracy.
What Problem Does This Paper Address?
Third-party libraries (TPLs) are the building blocks of modern Android development, but they also represent a massive attack surface. If an app includes a library version with a known vulnerability or a licensing conflict, it puts both developers and users at risk.
To mitigate this, security analysts use Software Composition Analysis (SCA) tools to detect which TPLs are inside an APK. While current tools are highly accurate at identifying the library itself (e.g., "this app uses Gson"), they struggle to identify the exact version (e.g., "this app uses Gson 2.6, not 2.5"). This failure happens for two main reasons:
- Obfuscation Sensitivity: Common protection techniques like identifier renaming and control-flow flattening destroy the superficial code features that traditional tools rely on.
- Subtle Version Differences: Successive versions of a library often have minimal code differences, leading to high false-positive rates where tools mistakenly report multiple versions as present.
Furthermore, the authors point out that prior research used overly relaxed evaluation metrics, masking how poorly existing tools actually perform at the version level.
Methods
SAD (Structural Similarity-based Android TPL Detector) tackles these challenges through a three-stage pipeline: Preprocessing, Class Matching, and TPL Detection.
1. Preprocessing & Graph Feature Propagation
SAD extracts a Class Dependency Graph (CDG) from both the app and the target TPLs. In a CDG, nodes represent classes (retaining only basic modifiers like abstract or interface) and edges represent inheritance or implementation. To make these nodes distinct without relying on easily obfuscated names, SAD uses a message-passing approach inspired by Graph Neural Networks (GNNs). Node features are iteratively aggregated from their neighbors exactly as many times as the diameter of the TPL graph, ensuring consistent structural signatures.
2. Fine-Grained Class Matching
To filter out false candidates, SAD splits classes into stateful (containing non-static fields) and stateless.
- For stateful classes, SAD performs data-flow taint analysis to slice instructions and resist control-flow flattening. It then simulates method invocation sequences to generate a Functionality Summary based on field operations (initialization, assignment, etc.).
- These summaries are matched across the app and TPL using the Hungarian algorithm, which optimizes the alignment of semantic behaviors despite renaming.
3. Subgraph Structural Validation
Finally, SAD verifies if the matched classes form structurally identical paths to terminal nodes within the CDG. If multiple library versions yield identical structural confidence scores, SAD breaks the tie by analyzing literal features (like hardcoded strings or constants) to isolate the exact version.
Datasets
The authors evaluated SAD using a benchmark dataset originally compiled for LibScan, which they manually reviewed and corrected to improve ground-truth accuracy. The dataset consists of 1,231 apps and 562 TPL versions, split into three distinct evaluation scenarios:
- $D_1$ (Non-obfuscated): 203 apps used as a baseline.
- $D_2$ (Obfuscated): Apps processed with commercial-grade tools (Allatori, DashO, and ProGuard) using configurations like control-flow randomization, package flattening, and dead code removal.
- $D_3$ (Optimized): Apps compiled using modern Android optimization pipelines (D8 and R8) that perform aggressive code shrinking and method inlining.
Key Insights and Ideas
- Reversing the Flow to Filter Noise: When propagating graph features, SAD aggregates features from dependent nodes (the opposite direction of the CDG edges). Because app dependencies flow from the main program toward the TPLs, this design choice prevents the main app's code from polluting the TPL node signatures.
- Field Operations as Semantic Anchors: While method names and control flows change constantly during obfuscation, the way an object manipulates its internal state (field reads/writes) remains semantically invariant. Capturing this via field operation sequences ($FOS$) provides a powerful abstraction layer against obfuscation.
- Exposing the "Relaxed Metric" Flaw: Prior work counted a version detection as a True Positive if the tool reported a list of versions that included the correct one, ignoring the incorrect guesses. The authors introduce a stricter metric, Version-level$^\dagger$, which penalizes tools for every incorrect version they hallucinate. Under this realistic lens, traditional tools see a massive performance drop, highlighting the need for SAD's precision.
Key Results
SAD achieves state-of-the-art performance across the board, particularly under heavy obfuscation.
Library and Version-Level Performance
On the obfuscated dataset ($D_2$), SAD achieved a 97.64% F1 score at the library level. More importantly, under the strict Version-level$^\dagger$ metric, SAD achieved an 84.82% F1 score, outperforming the next best tool (LIBLOOM) by over 10%.
Class-Level Reliability
SAD also excelled at mapping specific classes inside the APK to their true library counterparts, achieving a class-level F1 score of 94.12% (an 11% improvement over LibScan). This makes it highly reliable for downstream tasks like automated vulnerability patching, where you must know exactly which class to modify.
Limitations and Future Work
Despite its strengths, SAD has a few notable limitations:
- Advanced Obfuscation: It cannot currently handle extreme obfuscation techniques like Dex file encryption, reflection-heavy invocations, or code virtualization.
- The Optimization Challenge: Aggressive compiler optimizations (like R8's method inlining) alter the structural graph by dissolving methods into their callers. As a result, SAD's performance drops on heavily optimized, non-obfuscated apps ($D_3$).
- Execution Overhead: Because graph feature propagation and semantic summary generation are computationally heavy, SAD is slower than lightweight hashing approaches like LIBLOOM, making it less ideal for massive, high-throughput app store scanning without multi-process acceleration.
Summary updated