android-intent-security

Hardens Android components and Intent handling against redirection and unauthorized access.

Updated May 21, 2025
One-click install
npx skills add https://github.com/albertmartorell1975/MeteoMartoCompose --skill android-intent-security-albertmartorell1975
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: android-intent-security
Source: https://github.com/albertmartorell1975/MeteoMartoCompose/tree/main/.agents/skills/android-intent-security
Command: npx skills add https://github.com/albertmartorell1975/MeteoMartoCompose --skill android-intent-security-albertmartorell1975

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires androidx.core:core:1.9.0.

What problem does it solve? Android apps that expose Activities, Services, Broadcast Receivers, or ContentProviders are vulnerable to Intent redirection, component hijacking, and privilege escalation when incoming Intents are not validated. This Skill provides concrete patterns to audit and secure these components. ## Core Features & Use Cases - Safe Intent Redirection: Validate nested Intents manually or with AndroidX IntentSanitizer before launching them. - PendingIntent Hardening: Enforce FLAG_IMMUTABLE by default and require explicit target components for mutable PendingIntents. - Component Protection: Configure signature-level permissions, exported flags, and ContentProvider read/write permissions in AndroidManifest.xml. - Use Case: While auditing an app's AndroidManifest.xml, you find an exported Activity that launches a nested Intent from extras. Use this Skill to replace the unsafe launch with an IntentSanitizer allowlist and add signature-level permission protection. ## Quick Start Audit my AndroidManifest.xml and all Intent handling code for Intent redirection vulnerabilities and apply the recommended security fixes.

Frequently Asked Questions about android-intent-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Intent redirection vulnerabilities in Android?▼

Validate any nested Intent before launching it: verify the target package matches your app, confirm the target component is exported, and strip URI permission grant flags. With AndroidX Core 1.9.0+, use IntentSanitizer with an explicit allowlist of components, actions, and extras.

Should I use FLAG_IMMUTABLE or FLAG_MUTABLE for PendingIntent?▼

Use PendingIntent.FLAG_IMMUTABLE by default for alarms and notifications. Only use FLAG_MUTABLE when required, such as inline notification replies, and always set an explicit target component on the base Intent to prevent hijacking.

How do I secure an exported Android Service against untrusted callers?▼

Retrieve the calling UID with Binder.getCallingUid(), resolve it via PackageManager.getPackagesForUid(), and verify the caller's signing certificate with hasSigningCertificate. Perform this check inside each Binder transaction method, not in onBind, since binder connections are cached.

Does IntentSanitizer work on older Android versions?▼

IntentSanitizer requires AndroidX Core 1.9.0 or higher as a library dependency and works at the app level regardless of device API. Without it, you must manually verify the nested Intent's target package and exported status before launching.

What are the limitations of this Intent security approach?▼

This guidance covers only local inter-component and inter-app communication security on Android. It does not address network security, web integration, or host-to-server security, which require separate hardening practices.