Android platform checks

Android content provider security testing

A content provider is a database or file interface that other apps can query. When it is exported or grants access too freely, it hands out data directly.

How providers are exposed

A provider declared with android:exported="true" can be queried by any app unless it requires a permission. Since Android 4.2, providers default to not exported for apps targeting API 17 or later, so an exported provider is usually a deliberate choice worth reviewing. A provider that is not exported can still be reached through android:grantUriPermissions when the app hands out a URI with a read or write grant.

Inter-app data exposure belongs to MASVS-PLATFORM.

What can go wrong

Common content provider issues
IssueWhat to look for
Unprotected dataAn exported provider without readPermission or writePermission, or with a permission whose protection level is normal.
SQL injectionA query implementation that concatenates selection, projection or sortOrder into raw SQL.
Path traversalAn openFile implementation that builds a file path from the URI without normalizing it, allowing ../ sequences.
Broad FileProvider pathsA FileProvider path configuration using root-path or sharing the whole data directory with path=".".
Unsafe URI grantsGranting read or write access to a URI that came from another app, or forwarding grants inside an intent without checking the target.

Static check

From the merged manifest, list every <provider> with its authorities, exported state, permissions, grantUriPermissions and path-permission entries. Open the FileProvider path XML referenced by android.support.FILE_PROVIDER_PATHS. Then read each provider's query, insert, update, delete and openFile methods.

Runtime check

Query each exported authority with the content tool, for example adb shell content query --uri content://<authority>/<path>. Try other paths, a --where clause with a single quote to see whether errors reveal raw SQL, and file URIs with encoded traversal sequences.

Commands run from adb shell have shell privileges that a normal app does not; repeat important results from an unprivileged test app before reporting them.

Only test providers in apps you are authorized to assess, using test data.

Fix and report

Set exported="false" unless other apps truly need access; when they do, protect the provider with a signature-level permission. Use parameterized queries and allow-list columns. Canonicalize file paths and confirm they stay inside the intended directory. Narrow FileProvider paths to the specific folders you share.

Report the authority, the exact command or test-app call, and the data returned. Exported activities, services and receivers are covered in the exported components guide.

Related reading