Exploiting Android System Services Through Bypassing Service Helpers

Yacong Gu, Yao Cheng, Lingyun Ying, Yemian Lu, Qi Li, Purui SuSecureComm 2016 · DOI

TL;DR

This paper reveals a significant security vulnerability in Android: system services can be exploited by bypassing their "service helpers," which are meant to enforce security. The researchers developed a novel method to systematically identify these vulnerabilities, discovering 22 exploitable flaws in Android 6.0.1 that can lead to serious consequences like privilege escalation and system crashes.

What Problem Does This Paper Address?

Android applications (apps) rely on system services to access core functionalities like telephony or notifications. To protect these services from malicious use, Android employs "service helpers." These helpers act as intermediaries, validating input and checking caller identities before passing requests to the actual system service. The problem is that these service helpers can be bypassed, allowing malicious apps to directly interact with system services and circumvent the intended security checks. This bypass can lead to severe security and privacy threats, including privilege escalation, unauthorized function execution, system crashes, and denial-of-service (DoS) attacks. While previous research has touched upon Android security, a systematic study of vulnerabilities arising specifically from bypassing service helpers and their real-world impact was lacking.

Methods

The authors propose a four-step approach to systematically identify these vulnerabilities:

  1. Enumerate System Services and IPC Methods: They identify all accessible system services and their Inter-Process Communication (IPC) methods, considering both framework and native layers. This involves leveraging the service manager and manually extracting methods for services not fully documented in AIDL files.
  2. Identify Service Helper Classes: They extend the Android SDK to define service helpers as classes that interact with system services via IPC methods and are accessible to third-party apps. They then associate system services with their corresponding service helpers at a method level, creating "method pairs." This step includes analyzing internal and hidden APIs accessible through Java reflection.
  3. Detect Security Mechanisms: For each method pair, they analyze both the system service and its helper for security mechanisms. This involves extracting code features related to input parameter validation, caller status validation, passing caller identity, and constraining duplicated requests. They use static analysis techniques, including def-use analysis and call graph construction.
  4. Detect Possible Vulnerabilities: They compare the security mechanisms in the system service method and its helper. If the system service lacks a security mechanism that its helper enforces, it's flagged as a potential vulnerability. These potential vulnerabilities are then manually confirmed through real-world attack construction.

Datasets

Not discussed in the paper. The research focuses on analyzing the Android 6.0.1 source code.

Key Insights and Ideas

  • Service Helpers are a Critical Security Layer, but Bypassing Them is Feasible: The core insight is that while service helpers are designed to protect system services, they are not foolproof. Malicious apps can directly call system service methods, bypassing the helper's security checks.
  • System Services Often Trust Helpers Too Much: The root cause of many vulnerabilities is that system services assume the service helper has performed all necessary security checks, leading to a lack of independent verification.
  • A Systematic Approach is Needed: Identifying these vulnerabilities requires a comprehensive method that analyzes both the service and its helper, considering various security mechanisms.
  • Real-World Impact is Significant: The discovered vulnerabilities are not theoretical; they can be exploited to achieve serious outcomes like gaining elevated privileges, performing actions without user consent, and crashing the entire system.

Key Results

The researchers applied their methodology to Android 6.0.1 and found:

  • 22 Vulnerabilities Identified: They discovered 22 vulnerabilities in system services that can be exploited by bypassing service helpers.
  • Confirmed by Android Security Team: All identified vulnerabilities were confirmed by the Android Security Team and assigned unique Android Bug IDs.
  • Categorization of Vulnerabilities: The vulnerabilities fall into several categories:
  • Fake Identity: 19 inconsistent method pairs where service helpers pass caller identity but services fail to verify it. Nine of these were exploitable, leading to privilege escalation (e.g., fingerprint authentication bypass).
  • Illegal Parameter: 51 method pairs with inconsistent input parameter validation. Three of these were found to be exploitable, leading to service crashes (e.g., Bluetooth service crash).
  • Fake Status: One vulnerability in NFC service where the helper checks caller status but the service does not, allowing background NFC data retrieval.
  • IPC Flooding: Nine methods in service helpers that handle duplicated requests can be bypassed, leading to resource exhaustion and potential system reboots.
  • Demonstrated Attacks: The paper details real-world attacks demonstrating the impact of these vulnerabilities, including:
  • User fingerprint authentication in the background.
  • NFC data retrieval in the background.
  • Bluetooth service crash.
  • Android system crash.

Limitations and Future Work

  • False Negatives: The authors acknowledge that their approach might miss some vulnerabilities due to:
  • Sequence of Check and Use: They don't fully consider scenarios where a service performs a sensitive operation before a security check, even if the check exists.
  • Native Code (JNI): The analysis does not cover system services that rely on native code via JNI, which could hide further vulnerabilities.
  • Manual Work: While largely automated, the process still requires manual effort for identifying non-AIDL IPC methods, verifying duplicated request handling, and confirming the exploitability of found vulnerabilities.
  • Future Work: The authors suggest analyzing services with JNI native code as a future research direction. They also propose that to completely prevent these attacks, services should enforce the same security mechanisms as their helpers, rather than solely relying on the helpers.

Summary updated

BibTeX
@inproceedings{gu2016exploiting,
  author = {Yacong Gu and Yao Cheng and Lingyun Ying and Yemian Lu and Qi Li and Purui Su},
  title = {{Exploiting Android System Services Through Bypassing Service Helpers}},
  booktitle = {SecureComm},
  year = {2016},
  doi = {10.1007/978-3-319-59608-2\_3},
}
Figure