This Is How He Could Hijack Reddit Accounts With Just One Click A 10 000 Bug Bounty
Reddit's OAuth implementation allowed an attacker to force the response mode to fragment, leaking tokens in the URL fragment. An attacker could then steal these tokens via postMessage and hijack the victim's account with one click.
Hijacking a random user’s account can be a dream goal of many malicious hackers. This can occur through traditional methods of data leaks and brute force passwords, but with additional security measures more commonplace, such as 2FA or OAuth, it (hopefully) is becoming harder to simply guess and check.
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 OAuth implementation did not restrict the response_mode parameter, allowing an attacker to force tokens to be returned in the URL fragment, which could then be leaked via postMessage.
Impact
An attacker could hijack a victim's Reddit account with one click if the victim uses Apple sign-in.
What the attacker needed
Victim uses Apple sign-in on Reddit; victim clicks a link; attacker has a valid state parameter
The fix
Reddit should restrict the allowed response_mode and response_type parameters to prevent token leakage in URL fragments.
How it was found
- The attacker completes a valid Apple sign-in to obtain a valid state parameter.
- The attacker creates a malicious page with an iframe pointing to redditmedia.com.
- The iframe initiates the Apple sign-in flow for Reddit using the attacker's state and a response_mode that returns tokens in the URL fragment.
- The victim logs in through the iframe, and the URL now contains the tokens in the fragment.
- The attacker reads the tokens from the iframe using postMessage (or XSS) and uses them to log in as the victim.
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 sign in to a site using another account, like 'Sign in with Apple'. Normally, after you sign in, the site gets a secret code to log you in. Here, a mistake let an attacker trick the site into putting that secret code in a part of the web address that could be read by a malicious page, so the attacker could steal it and take over your account.
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.