Skip to content

Lesson 3 of 13 · 13m

Intents, Deep Links, and Exported Components

Manifest-declared components are callable IPC — implicit exported defaults pre-Android 12, unverifiable custom schemes, intent redirection, mutable PendingIntents, and provider path traversal.

Your manifest is your attack surface

Mobile apps don't listen on sockets. They expose components: activities, services, broadcast receivers, and content providers, each declared in AndroidManifest.xml. An <intent-filter> makes a component reachable by implicit intents — and here's the trap that ran for a decade: any component with an intent filter defaulted to android:exported="true". Thousands of apps exposed internal activities to every other app on the phone without ever writing exported anywhere. Android 12 (API 31) ended the ambiguity: target S or later and a filtered component without an explicit exported attribute fails the build.

Deep links are the same problem wearing a web costume. A custom scheme — myapp://pay?to=x&amount=y — can't be verified. Any installed app can register the same scheme; Android shows a disambiguation sheet, iOS resolves the collision by rules Apple doesn't document. The fix is domain-verified linking: android:autoVerify="true" on the intent filter plus /.well-known/assetlinks.json on your domain bearing the app's sha256_cert_fingerprints (App Links), or applinks: entries in apple-app-site-association plus the com.apple.developer.associated-domains entitlement (Universal Links). Verified links route straight to your app, no sheet, and other apps can't claim them.

The bugs that actually ship

Intent redirection. An app receives an Intent inside an untrusted intent's extras, then calls startActivity() on it — a confused deputy that lets a zero-permission caller reach the target's non-exported components, with attacker-controlled extras. This is endemic enough that Play's App Security Improvements program emails warnings about it; the fix is an allowlist of components, or never re-launching caller-supplied intents at all.

PendingIntent. The base intent inside a PendingIntent must be empty and the flags immutable. Since Android 12 you must declare FLAG_IMMUTABLE or FLAG_MUTABLE explicitly — an implicit intent plus FLAG_MUTABLE means the sender fills in action, component, and data after the fact and fires your privileged grant wherever it wants. IllegalArgumentException on missing mutability is the platform forcing you to notice.

Content providers. openFile() implementations that join Uri paths to a root directory take .. traversals — and the percent-encoded variant (..%2f) sailed past naive checks for years because Uri.getPath() decodes before your startsWith(root) test runs. query() selection args are SQL injection surfaces. FileProvider has been the mandatory sharing mechanism since API 24 threw FileUriExposedException for file:// URIs — use it, grant per-URI read only, expire the grant.

Deep link parameter handling. Path patterns are prefix matches, and the extras inside a deeplink are user input. Microsoft's May 2022 writeup on TikTok for Android — CVE-2022-28799 — chained a non-verified deep link into a forced loadUrl and account-takeover primitives. The vulnerability class wasn't exotic; it was "navigate to an attacker-supplied URL inside your own WebView."

Broadcasts and receivers. Ordered broadcasts let receivers mutate the result before it reaches the next receiver; sticky broadcasts (deprecated API 21) let any receiver replay old intents. Receivers registered at runtime without a permission attribute are callable by anyone on the device.

Task hijacking. StrandHogg, disclosed by Promon in December 2019, abused taskAffinity/allowTaskReparenting to reparent a phishing activity into the victim app's task — the user sees the real app's task card and a fake login. StrandHogg 2.0 (CVE-2020-0096, critical, September 2020 bulletin) did it without taskAffinity by abusing activity internals. Android 10/11 shipped the mitigations; the lesson stands: the activity stack is shared state other apps can touch.

Enumerating it

drozer remains the fastest first pass: run app.package.attacksurface <pkg> prints exported counts by type, run app.activity.start --component <pkg> <exported> fires them. aapt dump badging and the decoded manifest give you the same list statically. For iOS, the equivalent surface is URL schemes in CFBundleURLTypes, the LSApplicationQueriesSchemes allowlist (capped at 50), and associated-domains entitlements.

Practice

exported="false" on everything, flipped to true deliberately. Verified links only — never trust data inside a custom-scheme URI beyond display text. PendingIntents: empty base + FLAG_IMMUTABLE. Provider file paths: canonicalize, then startsWith the canonical root after decoding. Treat every intent extra as hostile input — because it is.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.