Security

    iOS custom URL scheme hijacking: the deep-link risk

    A 2026 view of a malicious app registering another app's custom URL scheme to intercept an OAuth callback, contrasted with a domain-verified Universal Link that cannot be hijacked

    Custom URL schemes like myapp:// are a convenient way to open your app from a link, and a weak foundation to build security on. The problem is that iOS does not guarantee a scheme is unique, so another app, including a malicious one, can register the same scheme and intercept the URLs meant for you. If those URLs carry anything sensitive, an OAuth callback, a token, a reset link, that is a hijacking risk. The fix is Universal Links, which are tied to a domain you control. Here is how scheme hijacking works and how to handle deep links securely.

    Short answer

    A custom URL scheme like myapp:// can be hijacked because iOS does not enforce uniqueness, so another app can register the same scheme and receive URLs intended for your app. Per Apple's guidance, this makes custom schemes unsuitable for anything sensitive, since a malicious app could intercept data passed in the URL, such as an OAuth callback or a token. The secure alternative is Universal Links, which are bound to a domain you verify with an apple-app-site-association file, so they cannot be claimed by another app. Use Universal Links for sensitive links, never pass secrets through a custom scheme, and treat incoming URLs as untrusted input.

    What you should know

    • Custom schemes are not unique: iOS does not stop another app registering yours.
    • They can be hijacked: a malicious app can intercept your scheme's URLs.
    • Do not pass secrets via custom schemes: tokens and callbacks can be intercepted.
    • Universal Links are domain-bound: tied to a domain you verify, so they cannot be claimed.
    • Treat incoming URLs as untrusted: validate whatever arrives.

    What is URL scheme hijacking?

    It is another app registering your custom scheme and receiving links meant for you. On iOS, when you define a custom URL scheme, any other app can declare the same one, and if more than one app registers a scheme, the system does not guarantee which one handles it. A malicious app can deliberately register a popular app's scheme to intercept the URLs sent to it. That matters when those URLs carry sensitive data: a classic case is an OAuth flow that returns the authorization response to myapp://callback, where a hijacking app registered to that scheme could receive the response and the tokens in it. So scheme hijacking turns a convenient deep-link mechanism into an interception path whenever sensitive information rides on the URL.

    The difference is whether the link is bound to something you control. The table compares them.

    AspectCustom URL schemeUniversal Link
    UniquenessNot guaranteed; any app can register itBound to your verified domain
    Hijack riskYes, another app can interceptNo, it cannot be claimed by another app
    SetupDeclare the scheme in Info.plistHost an apple-app-site-association file on your domain
    Fit for sensitive dataNoYes, when needed
    FallbackNone if the app is absentOpens your website if the app is not installed

    Universal Links use a URL on a domain you own, verified by hosting an apple-app-site-association file, so only your app, associated with that domain, handles them. That binding to a domain you control is exactly what custom schemes lack, which is why Universal Links are the right choice for any link that matters.

    Prefer Universal Links, keep secrets off the URL, and validate input. For any link that carries sensitive meaning, use Universal Links bound to your verified domain rather than a custom scheme, so it cannot be hijacked. For authentication specifically, use the system's secure authentication session for OAuth rather than returning tokens to a custom scheme, since that flow is designed to deliver the result to your app safely. Never pass secrets, tokens, or trusted commands through a custom scheme, and treat every incoming URL, of any kind, as untrusted input: validate it, do not assume it came from a legitimate source, and do not perform a sensitive action just because a URL asked. The principle is that a deep link can be forged or intercepted, so it should trigger only safe behavior unless the link type itself, like a Universal Link, provides the trust.

    What to watch out for

    The first trap is running an OAuth or sensitive callback through a custom scheme, where a hijacking app can intercept the token; use Universal Links or the secure authentication session. The second is trusting an incoming custom-scheme URL as if it authenticated the caller, when anyone can craft one. The third is assuming your scheme is yours, when iOS does not guarantee it. A pre-submission scan such as PTKD.com (https://ptkd.com) reads the compiled IPA against OWASP MASVS and surfaces the URL schemes your app declares and how it handles links, so you can spot a sensitive flow riding on a custom scheme before you ship. Moving sensitive links to Universal Links is the fix.

    What to take away

    • A custom URL scheme can be hijacked because iOS does not guarantee uniqueness, so another app can register it and intercept your links.
    • Never pass secrets, tokens, or OAuth callbacks through a custom scheme, since a hijacking app could intercept them.
    • Use Universal Links, bound to a domain you verify, for any link that matters, and the secure authentication session for OAuth.
    • Treat all incoming URLs as untrusted input, and use a pre-submission scan such as PTKD.com to find sensitive flows riding on custom schemes.
    • #ios
    • #url-scheme
    • #universal-links
    • #deep-links
    • #oauth
    • #owasp-masvs
    • #app-security

    Frequently asked questions

    What is URL scheme hijacking on iOS?
    It is another app registering your custom URL scheme and receiving links meant for your app. iOS does not enforce that a scheme is unique, so if more than one app registers the same scheme, the system does not guarantee which one handles it. A malicious app can deliberately register a popular app's scheme to intercept its URLs, which is a problem when those URLs carry sensitive data like an OAuth callback or a token.
    Are custom URL schemes safe for OAuth?
    No. Returning an OAuth authorization response to a custom scheme like myapp://callback is risky, because a hijacking app registered to that scheme could receive the response and the tokens in it. Use Universal Links bound to your verified domain, or the system's secure authentication session designed for OAuth, which delivers the result to your app safely. Never carry tokens or secrets on a custom scheme, since it can be intercepted.
    How are Universal Links more secure than custom schemes?
    Universal Links use a URL on a domain you own, verified by hosting an apple-app-site-association file, so only your app, associated with that domain, handles them. That binding to a domain you control is what custom schemes lack, which is why another app cannot claim a Universal Link the way it can register your custom scheme. Universal Links also fall back to your website if the app is not installed, while a custom scheme simply fails.
    Can I trust data that arrives via a URL?
    No, treat every incoming URL as untrusted input. Anyone can craft a custom-scheme URL, and even legitimate-looking links can be forged or intercepted, so do not assume a URL authenticated its sender or perform a sensitive action just because a URL asked. Validate the input, and reserve sensitive behavior for link types that provide trust, like Universal Links bound to your domain, rather than acting on a raw custom-scheme URL.
    How do I find sensitive flows using custom schemes?
    Scan the build. A pre-submission scan such as PTKD.com reads the compiled IPA against OWASP MASVS and surfaces the URL schemes your app declares and how it handles incoming links, so you can spot a sensitive flow, like an OAuth callback, riding on a custom scheme before you ship. If it finds one, the fix is to move that flow to a Universal Link or the secure authentication session and keep secrets off custom-scheme URLs.

    Keep reading

    Scan your app in minutes

    Upload an APK, AAB, or IPA. PTKD returns an OWASP-aligned report with copy-paste fixes.

    Try PTKD free