Mobile OAuth Attacks - iOS URL Scheme Hijacking Revamped
Many iOS apps use custom URL schemes for OAuth redirects, and an attacker app can register the same scheme and use ASWebAuthenticationSession to silently obtain an authentication code, leading to account takeover. The attack works because ASWebAuthenticationSession can open a URL that redirects to the victim's OAuth endpoint with prompt=none, and the redirect is delivered to the attacker's app.
Published on evanconnelly.github.io
We (Julien Ahrens @MrTuxracer and myself @EvanConnelly) identified nearly 30 popular apps, as well as a feature within iOS itself, vulnerable to an attack in which any installed iOS app from the Apple App Store could perform an account takeover of victim users.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the use of custom URL schemes for OAuth redirects combined with ASWebAuthenticationSession's ability to deliver redirects to any registered scheme, and the availability of prompt=none to bypass user interaction.
Impact
An attacker could take over victim users' accounts on vulnerable apps, and common protections like PKCE do not prevent it.
What the attacker needed
Victim has vulnerable app installed; victim has active session on victim domain; attacker app installed on victim's device; victim allows opening attacker's website
The fix
The attack should be fixed by using universal links instead of custom URL schemes in OAuth flows, or by requiring a consent step before automatically authorizing the client.
How it was found
- Attacker app uses ASWebAuthenticationSession to open a URL on attacker's website.
- Attacker's website redirects to the victim app's OAuth authorization endpoint with prompt=none and the victim app's custom URL scheme as redirect_uri.
- The authorization server, seeing an active session, silently returns an authentication code via a redirect to the custom URL scheme.
- The ASWebAuthenticationSession in the attacker app receives the redirect and extracts the code.
- The attacker app exchanges the code for an access token, gaining access to the victim's account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you log into an app using another service (like Facebook), the app receives a special code to prove who you are. This report shows that a malicious app on your iPhone could trick that login process into sending the code to the attacker instead, letting them access your account. The trick relies on how iPhones handle app-specific links and a feature that lets apps open web pages without you noticing.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.