Improper Export of Android Application Components

Incomplete Variant
Structure: Simple
Description

This vulnerability occurs when an Android app makes a component (like an Activity, Service, or Content Provider) available to other apps without enforcing proper security checks. This allows unintended or malicious applications to interact with the component, potentially leading to data theft, unauthorized actions, or application compromise.

Extended Description

When you export an Android component without restrictions, you create an open door for other apps on the device. For Activities, this can let malicious apps launch your screens to steal data, modify your app's state, or impersonate your UI to trick users. For Services, unauthorized apps can bind to and trigger functionality, potentially performing actions they shouldn't or corrupting your app's logic. Content Providers are especially risky, as versions of Android before 4.2 automatically export them unless you explicitly set them as private, which can lead to direct data leaks. To prevent this, always explicitly set the `android:exported` attribute in your AndroidManifest.xml and implement strong permission checks. Use signature-level permissions for components that should only communicate with your own apps. For Content Providers, explicitly declare them as not exported if they're for internal use only, and always apply URI permissions for temporary data sharing. Never rely on default export behaviors, as they often prioritize convenience over security.

Common Consequences 3
Scope: AvailabilityIntegrity

Impact: Unexpected StateDoS: Crash, Exit, or RestartDoS: InstabilityVaries by Context

Other applications, possibly untrusted, can launch the Activity.

Scope: AvailabilityIntegrity

Impact: Unexpected StateGain Privileges or Assume IdentityDoS: Crash, Exit, or RestartDoS: InstabilityVaries by Context

Other applications, possibly untrusted, can bind to the Service.

Scope: ConfidentialityIntegrity

Impact: Read Application DataModify Application Data

Other applications, possibly untrusted, can read or modify the data that is offered by the Content Provider.

Detection Methods 1
Automated Static AnalysisHigh
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Potential Mitigations 4
Phase: Build and Compilation

Strategy: Attack Surface Reduction

If they do not need to be shared by other applications, explicitly mark components with android:exported="false" in the application manifest.
Phase: Build and Compilation

Strategy: Attack Surface Reduction

If you only intend to use exported components between related apps under your control, use android:protectionLevel="signature" in the xml manifest to restrict access to applications signed by you.
Phase: Build and CompilationArchitecture and Design

Strategy: Attack Surface Reduction

Limit Content Provider permissions (read/write) as appropriate.
Phase: Build and CompilationArchitecture and Design

Strategy: Separation of Privilege

Limit Content Provider permissions (read/write) as appropriate.
Demonstrative Examples 2
This application is exporting an activity and a service in its manifest.xml:

Code Example:

Bad
XML
xml

...* ```

xml

...* ```

xml
Because these components have intent filters but have not explicitly set 'android:exported=false' elsewhere in the manifest, they are automatically exported so that any other application can launch them. This may lead to unintended behavior or exploits.
This application has created a content provider to enable custom search suggestions within the application:

Code Example:

Bad
XML
xml
Because this content provider is only intended to be used within the application, it does not need to be exported. However, in Android before 4.2, it is automatically exported thus potentially allowing malicious applications to access sensitive information.
References 1
Security Tips
Android Open Source Project
16-07-2013
ID: REF-923
Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Technologies:
Mobile : Undetermined
Modes of Introduction
Architecture and Design
Related Weaknesses