Skip to main content

Unauthorized access to files - APK Content Provider

Description

The Content Provider API allows third party applications installed in the device to retrieve data stored by the application. Access to this data must not be allowed to all applications by default. Instead, (and only if required) specific allow-lists must be used.

Impact

Leak application information to all applications installed in the device through the Content Provider API.

Recommendation

  • Deny access to all Content Providers with: android:exported=false and android:grantUriPermissions=false. If required you can allow specific Content Providers by using grant-uri-permission. - If the attribute android:grantUriPermissions=true is required, establish a custom permission using the permission tag with a Signature protection level. By doing so, the application will only share permissions if the request originates from an app signed with the same certificate. This ensures a secure sharing of permissions only with trusted applications signed using a matching certificate.

Threat

Unauthorized local attacker owner of a third party application installed in the device.

Expected Remediation Time

⌚ 30 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the src.

Base

  • Attack vector: L
  • Attack complexity: H
  • Privileges required: N
  • User interaction: R
  • Scope: U
  • Confidentiality: L
  • Integrity: N
  • Availability: N

Temporal

  • Exploit code madurity: U
  • Remediation level: O
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N/E:U/RL:O/RC:X
  • Score:
    • Base: 2.5
    • Temporal: 2.2
  • Severity:
    • Base: Low
    • Temporal: Low

Score 4.0

Default score using CVSS 4.0 . It may change depending on the context of the src.

Base 4.0

  • Attack vector: L
  • Attack complexity: H
  • Attack Requirements: N
  • Privileges required: N
  • User interaction: A
  • Confidentiality (VC): L
  • Integrity (VI): N
  • Availability (VA): N
  • Confidentiality (SC): N
  • Integrity (SI): N
  • Availability (SA): N

Threat 4.0

  • Exploit madurity: U

Result 4.0

  • Vector string: CVSS:4.0/AV:L/AC:H/AT:N/PR:N/UI:A/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:U
  • Score:
    • CVSS-BT: 0.2
  • Severity:
    • CVSS-BT: Low

Compliant code

Ideally, there should be no access allowed to third party content providers

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.system" android:versionCode="4" android:versionName="1.0" package="com.android.zerosms">
<uses-permission android:name="android.permission.SEND_SMS"/>
<application android:label="@7F040001" android:icon="@7F020002">
<provider
android:authorities="com.andriod.databasetest.contentprovider"
android:name=".db.ContentProviderDb"
android:exported="false"
android:grantUriPermissions="false">
</provider>
</application>
</manifest>

Non compliant code

The application allows external content providers with an export and Uri permissions set to true

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="android.uid.system" android:versionCode="4" android:versionName="1.0" package="com.android.zerosms">
<uses-permission android:name="android.permission.SEND_SMS"/>
<application android:label="@7F040001" android:icon="@7F020002">
<provider
android:authorities="com.andriod.databasetest.contentprovider"
android:name=".db.ContentProviderDb"
android:exported="true"
android:grantUriPermissions="true">
</provider>
</application>
</manifest>

Requirements

Fixes

free trial

Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.