# Mobile OAuth and Deep Link Attacks
> How mobile apps route inbound URLs — custom schemes, Android deep links/App Links, iOS Universal Links — and the validation failures that turn a crafted link into account takeover, file theft, or privilege escalation.
## The link-handling surface
Mobile platforms let other apps and web pages hand a URL to an app. Each mechanism has a different trust property:
| Mechanism | Scheme | Claimable by other apps? | Verification |
|---|---|---|---|
| Android deep link | custom (`app://`) or http(s) | Yes — multiple apps can register the same filter; a disambiguation dialog may show | none by default |
| Android App Link | http/https only | No, if verified | `android:autoVerify="true"` + `/.well-known/assetlinks.json` |
| iOS custom URL scheme | custom | First-come-first-served, but not exclusive | none |
| iOS Universal Link | https | No | `apple-app-site-association` (AASA) + Associated Domains entitlement |
Custom schemes and unverified deep links are the weak forms: any app can claim the scheme, and a browser page can trigger it. App Links and Universal Links are the hardened forms, but only when autoVerify/AASA are correct and the receiver still validates the payload.
## Android deep-link abuse
A deep link is an input to whatever the target activity does. Failures:
- **Missing/weak validation → ATO.** A deep link that feeds an untrusted server address or URL into a sensitive flow. kChat (`kchat://<server>/login/one_time_link?t=...`) took the server address from the link without checking it belonged to kChat; an attacker server captured the magic-link token and push tokens, then received messages (High, CVSS 7.1). The abdelnasserr writeups show the pattern repeatedly: `scheme://webview?url=` with no scheme/domain validation, where a WebView re-issues requests through an OkHttp client injecting auth headers → one-click ATO (often rediscovered after a "fixed" dup).
- **Intent redirection.** An exported component forwards an attacker-controlled intent/extra under the app's identity. EngageLab's `MTCommonActivity` (in millions of apps incl. crypto wallets) read `n_intent_uri` from an incoming intent and dispatched it, bypassing the sandbox to reach non-exported components (Microsoft). A `Class.forName()` on an attacker string launches arbitrary internal activities — frequently an insecure WebView (see [[WebView Vulnerabilities]]).
- **Parser abuse.** Deep-link parsers that rebuild `Serializable`/`Parcelable`/`Intent` objects from bytes can set insecure flags or reach arbitrary components. Impact ladder: data exposure, session hijack, open redirect, LFI, XSS, RCE (developer.android.com MASVS-PLATFORM; InjuredAndroid via Drozer).
Defense: `android:autoVerify="true"` + `assetlinks.json`; validate every extra and the full URL (scheme + host + path); treat exported components as attacker-reachable.
## iOS URL-scheme and Universal Link abuse
- **OAuth code theft via `ASWebAuthenticationSession`.** The session carries Safari cookies. Combined with an OAuth `prompt=none` silent-auth flow, a malicious app opens an attacker domain (so the consent prompt shows *attacker.com*, not victim.com), which 302-redirects into the victim app's auth endpoint; the returned auth code lands on the attacker's custom scheme. ~30 popular apps plus an iOS feature were vulnerable — ATO bypassing PKCE, no classic scheme-squatting needed (Connelly & Ahrens). Evil-PWA variants abuse custom protocol handlers to bypass `redirect_uri` origin checks (Casdoor).
- **Universal Links.** AASA can leak sensitive/unreleased paths; since iOS 14 it's also served from Apple's CDN, so triage both origin and cached copies. Weak receiver validation in `application:continueUserActivity:restorationHandler:` permits spoofing (CVE-2024-10474). Test with MASTG-TEST-0070 / AASA Validator.
- **Confirmation-prompt bypass.** Chrome for iOS treated Shortcuts (`shortcuts://`, `workflow://`) as trusted; a page chained navigation to Shortcuts with a `tel:` callback, reaching the phone handler without Chrome's user-gesture check (CVE-2026-13795).
## Testing
Enumerate intent filters / `CFBundleURLSchemes` / Associated Domains and AASA; check `autoVerify` and `assetlinks.json`; fuzz every extra and URL component; trace where link data flows (WebView loads, auth flows, `Class.forName`, OkHttp header injection). Drozer/ADB `am start` for Android; craft custom-scheme pages for iOS.
## Related
- [[Mobile Application Security]] · [[WebView Vulnerabilities]] · [[Android App Security]] · [[iOS App Security]] · [[OAuth 2.0 Vulnerabilities]] · [[Account Takeover]] · [[OWASP Mobile Top 10]]
## Sources
- [[raw/0xn3va.gitbook.io/deep-linking-vulnerabilities-application-security-cheat-sheet-4015|Deep Linking Vulnerabilities cheat sheet]]
- [[raw/developer.android.com/unsafe-use-of-deep-links-android-developers-security-4018|Unsafe use of deep links (Android Developers)]]
- [[raw/hackingarticles.in/android-pentest-deep-link-exploitation-4019|Android Pentest: Deep Link Exploitation]]
- [[raw/medium.com/how-a-login-link-could-switch-kchat-to-an-attacker-s-server-15081|How a Login Link Could Switch kChat to an Attacker's Server]]
- [[raw/abdelnasserr.medium.com/one-deep-link-zero-validation-full-ato-again-13613|One Deep Link, Zero Validation, Full ATO (Again)]]
- [[raw/microsoft.com/intent-redirection-vulnerability-in-third-party-sdk-exposed-millions-o-4027|Intent redirection in a third-party SDK (EngageLab)]]
- [[raw/evanconnelly.github.io/mobile-oauth-attacks-ios-url-scheme-hijacking-revamped-4008|Mobile OAuth Attacks — iOS URL Scheme Hijacking Revamped]]
- [[raw/book.hacktricks.wiki/ios-universal-links-hacktricks-4006|iOS Universal Links (HackTricks)]]
- [[raw/blog.slonser.info/why-protocol-matters-evil-pwa-attack-on-casdoor-11449|Evil PWA Attack on Casdoor]]