Skip to content
OAuth / SSO Write-up Intermediate

I HACKED THE ADMIN WITH A SOCIAL LOGIN

The OAuth linking flow lacked a state parameter, so an attacker could CSRF the admin into linking the attacker's social account. The attacker then logged in via social login and gained admin access.

medium.com

Published on medium.com

⚠️ This lab is from PortSwigger’s Web Security Academy. � Topic: Forced OAuth Profile Linking 🧠 Level: Intermediate | 💥 Impact: Account Takeover

Sumanth Yerranagula, 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

The OAuth flow did not use a state parameter, so the linking request could be forged by another site.

Impact

An attacker could take over the admin account and gain full admin access.

What the attacker needed

A normal user account; a social media account; victim (admin) clicks a link; attacker can host an exploit page

The fix

The OAuth flow should include and validate a state parameter to prevent CSRF.

How it was found

  1. Log in as a normal user and link a social profile.
  2. Capture the OAuth linking request and note the missing state parameter.
  3. Copy the linking URL with the code and drop the request to keep it valid.
  4. Host an iframe pointing to that URL on an exploit server.
  5. Send the exploit to the admin.
  6. Log in with the linked social account to gain admin access.

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.

OAuth is a way to log in using another service, like 'Log in with Google'. The site forgot a security check called 'state' that proves the login request came from the user, so an attacker could trick the admin into linking the attacker's social account. Then the attacker could log in as the admin.

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.