Skip to content
Skillpedia
Security10k · #11933

android-permissions-security

What it does

This skill audits Android permissions and the security of components that other apps can reach. It also covers runtime permission requests. It is for Android developers who want to apply least privilege to their app.

When to use it

  • ✓When you want to review AndroidManifest permissions and remove the ones the app does not need.
  • ✓When you want to define a custom permission to protect your app's exported components.
  • ✓When you need to verify the calling app's identity in a service or provider.

Skill link

https://github.com/android/skills/blob/main/security/android-permissions-security/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/android/skills/blob/main/security/android-permissions-security/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Review the permissions in my AndroidManifest and secure the services and receivers that other apps can call.”

5 new skills a week. 1 minute to read.

How it works

The skill checks the manifest for risky permission settings and exported components. It then recommends fixes such as custom permissions, caller signature checks and proper runtime permission flows.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Guidelines for auditing permission vulnerabilities, enforcing least privilege, securing IPC boundaries, and handling runtime permissions across the Android ecosystem.

Glossary

  • Runtime Permission: Dangerous permission (e.g., Camera, Location) that must be granted by the user at runtime on Android 6.0+ (API 23+).
  • Custom Permission: A permission defined by an app (<permission>) to restrict access to its exported components.
  • Protection Level: Attribute defining how the OS grants the permission (normal, dangerous, signature, knownSigner).
  • knownSigner: Protection flag (API 31+) granting signature-level access to partner apps matching trusted certificate digests.
  • SigningInfo: Object (API 28+) providing signing history and multiple signer certificates for an application.
  • Binder Calling Identity: Reliable UID representing the calling process obtained using Binder.getCallingUid().
  • URI Permission: Temporary, granular access granted to a content URI using grantUriPermissions and intent flags.

Prerequisites

  • Add androidx.core:core-ktx and androidx.activity:activity-ktx (or androidx.fragment:fragment-ktx) dependencies to the app-level build.gradle file for ContextCompat and ActivityResultContracts.
  • For knownSigner partner permissions (android:knownCerts), ensure the project compileSdk and targetSdk are at least 31 (Android 12).
  • For broadcast identity sharing (BroadcastOptions.setShareIdentityEnabled), ensure compileSdk and targetSdk are at least 34 (Android 14).

1. Security audit and permission gap detection playbook

When auditing an Android project for permission and IPC security vulnerabilities, systematically inspect each area:

Vulnerability Area Search In / Pattern Risk Remediation Action
Weak Custom Permission Protection AndroidManifest.xml with android:protectionLevel="normal", "dangerous", or "signatureOrSystem" Unauthorized apps request or claim permission without restriction Upgrade to signature or signature with knownSigner and android:knownCerts.
Overly Broad URI Permission Grants <grant-uri-permission android:pathPrefix="/" /> or pathPrefix="" in <provider> Leaks all provider data to third parties Replace with explicit scoped subpath (e.g. android:pathPrefix="/shared/"). Retain android:grantUriPermissions="true". Remove any wildcard pathPrefix="/".
Missing ContentProvider Split Permissions <provider> with only generic android:permission or missing android:readPermission and android:writePermission Read-only callers execute write operations or write-only callers access read operations Configure granular android:readPermission="...READ_DATA" and android:writePermission="...WRITE_DATA", AND declare the custom <permission> tags with android:protectionLevel="signature" (or signature with knownSigner) at the <manifest> root.
Spoofable Caller Identity Checks intent.getStringExtra("calling_package"), intent.getStringExtra("sender"), callingPackage == "..." in Services Malicious callers forge intent extras or strings Remove string checks; authenticate caller UID cryptographically using Binder.getCallingUid() and pm.hasSigningCertificate().
Bound Service Permission Bypass checkCallingOrSelfPermission() or enforceCallingOrSelfPermission() in Binder AIDL stubs Falls back to host app UID outside IPC or when identity is cleared, causing Confused Deputy bypass Replace with enforceCallingPermission("...WRITE_DATA", ...) or checkCallingPermission("...WRITE_DATA").
Missing Method-Level Checks in Bound Services Bound Service AIDL methods mutating state without enforcing write permissions Callers with read-only binding access invoke mutating write operations Add enforceCallingPermission("...WRITE_DATA", "Caller lacks WRITE_DATA permission") inside mutating AIDL methods.
Flawed Runtime Permission Flow Missing shouldShowRequestPermissionRationale(), missing permanent denial handling, or re-requesting in loops Poor user experience, infinite loops, or inability to recover permissions Implement 3-state flow: check grant -> check rationale dialog -> launch contract. On permanent denial, redirect to Settings.ACTION_APPLICATION_DETAILS_SETTINGS.
Simultaneous Location Requests `arrayOf(ACCESS_FINE_LOCATION, ACCESS_BACKGROUN
FAQ

What is a signature permission?

It is a permission granted only to apps signed with the same developer key, which the skill can use to limit access.

Does it handle runtime permission prompts?

Yes. It covers the runtime permission flow for dangerous permissions on Android 6.0 and newer.

Does it need extra libraries?

Yes. It notes that some AndroidX libraries are needed for the code it adds.

Details

Original description by the author

Audits, detects gaps, and remediates Android permissions and IPC component security vulnerabilities. Use when reviewing AndroidManifest.xml, defining custom permissions, securing Services, Receivers, and Providers, verifying caller signatures and UID using Binder, or implementing runtime permission flows.

repo: android/skills

Popularity

GitHub stars
10k
Ranking position
#11933
License
Apache-2.0
Updated
10/29/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills