Skip to content
OAuth / SSO Write-up Intermediate

How I was able to get two account takeovers via OAuth custom scheme hijacking at the same target

The Android app used a custom URL scheme to receive a temporary OAuth token after Google login, and a malicious app could register the same scheme to intercept that token. The attacker could then exchange the token for an authorization code and access the victim's account.

AlQa3Qa3_M0X0101 Follow

Published on medium.com

Hello guys, today I’m gonna explain how I got two account takeovers via OAuth custom scheme hijacking at the same target.

Mohamed reda, on medium.com

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 app relied on a custom URL scheme for a sensitive OAuth redirect without verifying the caller, allowing any app to register the same scheme and intercept the token.

Impact

An attacker could take over a victim's account by intercepting the OAuth token, though the victim may need to choose the malicious app in an Android chooser dialog.

What the attacker needed

Victim installs malicious app; victim logs in via Google OAuth; victim selects malicious app in chooser

The fix

The app should not send sensitive tokens via custom URL schemes; it should use Android App Links with verified HTTPS domains or another secure redirect mechanism.

How it was found

  1. The attacker creates a malicious Android app that registers the same custom URL scheme.
  2. The victim logs in with Google through the target app, which opens an external browser.
  3. After authentication, the target website redirects to the custom scheme with a temporary token.
  4. Android shows a chooser if multiple apps handle the scheme; the victim may select the malicious app.
  5. The malicious app captures the token and sends a GraphQL request to exchange it for an authorization code.
  6. The malicious app then sends another GraphQL request to retrieve the victim's user information.

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 in with Google, the app receives a secret code through a special link that starts with a custom name. Any other app on the phone can claim that same name, so it can receive the code instead. The attacker's app then uses the code to log in as the victim.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

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.