Facebook Takeover using Slack using 302 from files.slack.com with access_token
The Facebook OAuth app accepted any *.slack.com subdomain, including files.slack.com, which returns a 302 redirect. An attacker could craft an OAuth link sending the token to files.slack.com, where hash values follow the redirect, potentially enabling account takeover.
Originally disclosed on HackerOne
- Triaged in 35 hours
- Fixed in 8 months
- Paid in 8 months
- Disclosed after 9 months
Hi,
I noticed that your Facebook application used in the "Import Photo" can be used to take over the Facebook account of the user being attacked.
It's multiple issues in one:
- You have a 302 redirect from a *.slack.com domain. Hash-values will follow the redirect.
- The Facebook application OAuth settings are too weak, and a files.slack.com-URL will be accepted as the redirect_uri. You should restrict these to a www.slack.com that then redirects to the subdomain, instead of allowing all *.slack.com-subdomains, or deny the files.slack.com as a OAuth redirect-subdomain.
So, the following URL will redirect the user to files.slack.com after authentication of the app (or if the user already has it approved, no client interaction is needed):
I have attached POC-images showing what happens and what the Token provides as it is today (you can modify the scope, the user needs to approve it, but it still looks legit coming from Slack).
Regards, Frans
Attachments


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
The OAuth redirect_uri validation allowed any subdomain of slack.com, including files.slack.com, which is not a trusted OAuth endpoint and can host attacker-controlled redirects.
Impact
An attacker could obtain a Facebook access token with user_photos scope and take over the victim's Facebook account.
What the attacker needed
Victim clicks a link; victim has or approves the Facebook app
The fix
The OAuth redirect_uri should be restricted to a specific trusted Slack domain (e.g., www.slack.com) that then redirects to the subdomain, or files.slack.com should be denied as a redirect subdomain.
How it was found
- The attacker crafts a Facebook OAuth URL with redirect_uri pointing to a file on files.slack.com and response_type=token.
- The victim visits the URL; if the app is already approved, no interaction is needed, otherwise the victim approves the app.
- Facebook redirects the victim to files.slack.com with the access token in the URL fragment.
- The file on files.slack.com issues a 302 redirect, and the hash fragment follows the redirect.
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 to an app using Facebook, Facebook sends you back to the app with a token in the web address. This report found Facebook allowed the app to send that token to a Slack file-hosting subdomain, and hash values follow redirects there, which could let an attacker take over the 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.