Insecure Content Provider

An Android content provider is accessible to other apps without adequate permissions or input handling, exposing the app's data to any app on the device.

SeverityHigh
CVSS 3.17.1 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N Open in the calculator
CVSS 4.08.3 CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-926: Improper Export of Android Application Components
OWASP Top 10A08:2025 Software or Data Integrity Failures
CategoryBroken Access Control

Description

Content providers share an app's data with other apps through content:// URIs. A provider is accessible to other apps when it is exported, which was the default for apps targeting Android 4.1 (API level 16) or lower and otherwise requires android:exported="true". The weakness arises when an exported provider has no read or write permission, or one that any app can obtain, or grants URI permissions too broadly, so that other apps can query, insert, update or delete its data. A malicious app on the same device can then read the data the provider exposes, which often includes the user's personal data, messages or account information, and where write operations are available, change or delete it; the attacker needs the user to install their app, but needs no special permission.

Providers backed by SQLite databases are also prone to SQL injection through the projection, selection and sort order arguments, which can expose tables the provider was not meant to share, and providers that serve files through openFile are prone to path traversal when they build file paths from the URI. Either flaw can extend the exposure to the app's whole database or to private files such as stored tokens.

Testing enumerates providers and their URIs from the manifest and code, and queries them from adb, for example with adb shell content query --uri, from a test app, or with drozer's provider modules, which also test for injection and traversal.

Remediation

  • Set android:exported="false" on providers that are used only within the app.
  • For providers other apps must use, require android:readPermission and android:writePermission, with the signature protection level where the consumers are the developer's own apps, and use path-permission elements to restrict sensitive paths.
  • Grant temporary access to individual URIs with android:grantUriPermissions and intent flags rather than exporting the whole provider.
  • Pass selection values as arguments rather than building SQL strings, validate projections and sort orders against an allowlist, and consider SQLiteQueryBuilder with a projection map and strict mode.
  • For files, use FileProvider with narrowly scoped paths, and canonicalise and check any path built from a URI.

Confirm the fix by repeating the queries and injection tests from a separate app and checking that they are refused or return only the intended data.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Mobile Applications Findings

Every Mobile Applications finding