FLEXDROID: Enforcing In-App Privilege Separation in Android

Jaebaek Seo, Daehyeok Kim, Donghyun Cho, Insik Shin, Taesoo Kim

Abstract

Third-party libraries are ubiquitous in the Android ecosystem, yet they operate under the same permission set as their host applications, posing significant privacy and security risks. We present FLEXDROID, a framework that enforces in-app privilege separation. By leveraging inter-process stack inspection and hardware-based fault isolation (HFI) via ARM Domains, FLEXDROID restricts libraries to developer-defined permission subsets without the performance penalties of traditional process sandboxing. Our evaluation across 100,000 apps and real-world testing on 32 popular applications shows that FLEXDROID effectively blocks unauthorized permission usage with a negligible performance overhead of less than 2%.

Introduction

The modern Android application is a "mashup" of core functional code and numerous third-party libraries for advertising, analytics, and social media integration. Under the standard Android security model, permissions are granted at the process level. Consequently, an ad library embedded within a weather app inherits all permissions granted to that app, such as location or contact access. Existing solutions like process separation are often too slow or break library functionality, while static analysis fails to account for the dynamic code execution (reflection, JNI) used by over 70% of popular libraries.

System Architecture and Methodology

FLEXDROID introduces a robust mechanism for in-app privilege separation by modifying the Android framework and the Linux kernel. The system is built on three primary pillars:

1. Fine-grained Policy Specification

Developers can define library-specific permissions using a new <flexdroid> tag within the AndroidManifest.xml. This allows for explicit control over what resources a specific package can access.

2. Inter-process Stack Inspection

When an application requests a sensitive resource, FLEXDROID triggers a stack tracer to inspect the current execution path. If a restricted library is detected in the call stack, the request is validated against that library's specific policy rather than the host app's broad permissions.

FLEXDROID System Architecture showing the interaction between Userspace, Kernel, and the stack inspection mechanism.

3. Hardware-based Fault Isolation (HFI)

To prevent malicious libraries from using native code (JNI) to tamper with the call stack—thereby "faking" their identity—FLEXDROID utilizes ARM Domains. This hardware feature creates a memory barrier between the Java environment and native JNI code, ensuring the call stack remains an untampered "source of truth."

Call stack trace examples showing how FLEXDROID distinguishes between host application (A) and third-party library (L) principals.

Evaluation and Results

The researchers justified the design of FLEXDROID through a large-scale study of 100,000 Android apps from the Playdrone dataset. The study confirmed that 72% of libraries utilize dynamic class loading or reflection, and 17% use JNI, rendering static analysis-based security obsolete.

In practical testing, FLEXDROID was evaluated against 32 top-tier applications, including Instagram and Pinterest. The system successfully blocked "undocumented" permission requests—such as the Flurry analytics library attempting to read phone states without authorization—while maintaining high compatibility.

Performance

The performance impact of FLEXDROID is remarkably low. Common operations like launching an app or sending an email experienced a delay of only 1.13% to 1.55%. Most resource-specific checks added only a few hundred microseconds of latency, making the security overhead virtually imperceptible to the end-user.

Conclusion and Future Work

FLEXDROID demonstrates that in-app privilege separation is achievable without sacrificing performance or breaking complex library features. While some highly complex apps (e.g., Facebook, Waze) faced compatibility issues with the JNI sandbox due to low-level memory management conflicts, the majority of tested software operated seamlessly. Future work will focus on refining the JNI sandbox to handle custom memory allocators, aiming for universal compatibility.

Summary updated

BibTeX
@inproceedings{seo2016flexdroid,
  author = {Jaebaek Seo and Daehyeok Kim and Donghyun Cho and Insik Shin and Taesoo Kim},
  title = {{FLEXDROID: Enforcing In-App Privilege Separation in Android}},
  booktitle = {NDSS},
  year = {2016},
}
Figure