Skip to content
OAuth / SSO Disclosed report Intermediate

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.

Frans Rosén Follow

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:

  1. You have a 302 redirect from a *.slack.com domain. Hash-values will follow the redirect.
  2. 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):

https://www.facebook.com/dialog/oauth?client_id=569627156411038&redirect_uri=https%3A%2F%2Ffiles.slack.com%2Ffiles-pri%2FT025M9QPZ-F0283NJ20%2Fhash.swf&response_type=token&scope=user_photos&sdk=joey

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

Screen_Shot_2014-04-06_at_09.16.07.png
Screen_Shot_2014-04-06_at_09.16.07.png From the original on HackerOne
Screen_Shot_2014-04-06_at_09.16.24.png
Screen_Shot_2014-04-06_at_09.16.24.png

The original report as published on HackerOne, by fransrosen. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. The attacker crafts a Facebook OAuth URL with redirect_uri pointing to a file on files.slack.com and response_type=token.
  2. The victim visits the URL; if the app is already approved, no interaction is needed, otherwise the victim approves the app.
  3. Facebook redirects the victim to files.slack.com with the access token in the URL fragment.
  4. 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.

More by Frans Rosén

View all

26 more disclosed reports, best first.

More from Slack

View all

The newest disclosed reports for this program.

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.