Slack OAuth2 "redirect_uri" Bypass
Slack's OAuth2 authorisation endpoint accepted redirect_uri values that merely started with the registered domain, such as a different country domain or an attacker-controlled subdomain. An attacker could craft an authorisation link that sends the user's OAuth code to a domain they control.
Originally disclosed on HackerOne
- Triaged in 5 hours
- Fixed in 11 days
- Paid in 11 days
- Disclosed after 3 months
Hi,
I've found a way to circumvent redirect_uri restrictions imposed by the web application using domain-suffix/subdomain technique.
I created an OAuth application under https://api.slack.com/applications/new. That has OAuth redirect_uri configured to http://www.google.com.
So technically
Allowed Request shall be : https://slack.com/oauth/authorize?client_id=2190698099.2192071336&redirect_uri=http://www.google.com
Denied Request shall be:
Surprisingly If I point the redirect_uri to http://www.google.com.mx (see .mx suffix) the endpoint will be accepted, infact endpoint like http://www.google.com.attacker.com will be accepted too. The server doesn't block these suffix attacks.
So attackers can craft an OAuth endpoint like below to circumvent redirect_uri restrictions :
Thanks! Prakhar Prasad
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 redirect_uri validation used a prefix or substring match instead of an exact match, so any domain beginning with the registered value was accepted.
Impact
An attacker could craft an OAuth authorisation link that redirects the user's authorisation code to a domain they control.
What the attacker needed
Attacker registers an OAuth app; victim clicks a crafted authorisation link
How it was found
- Create an OAuth application with a redirect_uri set to a legitimate domain.
- Send an authorisation request with the registered redirect_uri and confirm it is accepted.
- Send a request with an unrelated redirect_uri and confirm it is denied.
- Send a request with a redirect_uri that appends a country suffix or attacker domain to the registered value and observe it is accepted.
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.
OAuth is a way for apps to ask you to log in with another service, like Slack. The service is supposed to send you back only to a web address the app owner registered in advance. Here, Slack checked only the beginning of the address, so an attacker could register a lookalike address and receive the login code.
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.