Skip to content
Open redirect Disclosed report Intermediate

open redirect in rfc6749

OAuth providers that follow RFC 6749 redirect users to a registered redirect URI even when the request fails due to an invalid scope, allowing an attacker to use their own client registration as an open redirect. An attacker can craft a link to the victim's authorization endpoint with a wrong scope and their own redirect URI, causing the victim to be sent to the attacker's site.

Antonio Sanso Follow

Originally disclosed on HackerOne

Bounty$3,000 View original
  • Fixed in 7 months
  • Paid in 7 months
  • Disclosed after 7 months

OAuth Providers (servers) that strictly follow rfc6749 are vulnerable to open redirect. Let me explain, reading [0]

If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.

If the resource owner denies the access request or if the request fails for reasons other than a missing or invalid redirection URI, the authorization server informs the client by adding the following parameters to the query component of the redirection URI using the "application/x-www-form-urlencoded" format, per Appendix B:

Now let’s assume this. I am registering a new client to the victim.com provider. I register redirect uri attacker.com.

According to [0] if I pass e.g. the wrong scope I am redirected back to attacker.com. Namely I prepare a url that is in this form:

http://victim.com/authorize?response_type=code&client_id=bc88FitX1298KPj2WS259BBMa9_KCfL3&scope=WRONG_SCOPE&redirect_uri=http://attacker.com

and this is works as an open redirector. Of course in the positive case if all the parameters are fine this doesn’t apply since the resource owner MUST approve the app via the consent screen (at least once).

I have notified also this issue to the OAuth mailing list.

See also http://www.ietf.org/mail-archive/web/oauth/current/msg13367.html and http://www.ietf.org/mail-archive/web/oauth/current/maillist.html. The consensus seems to be that some of the OAuth family spec should be updated... (currently under discussion)

A solution would be to return error 400 rather than redirect to the redirect URI or always show the consent screen (at least once until the app is accepted by the user) even in case of wrong parameter rather than redirect...

[0] https://tools.ietf.org/html/rfc6749#section-4.1.2.1

The original report as published on HackerOne, by asanso. 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

Likely the authorization server follows the RFC's instruction to redirect on errors other than invalid redirect URI, without validating that the error case should not redirect or requiring user consent first.

Impact

An attacker could use the OAuth provider as an open redirect to send users to a malicious site, though the positive case requires user consent and the report notes the issue is under discussion.

What the attacker needed

Attacker can register a client; victim clicks a crafted link

The fix

The authorization server should return a 400 error instead of redirecting to the redirect URI, or always show the consent screen even for invalid parameters.

How it was found

  1. Register a new client on the victim OAuth provider with redirect URI attacker.com.
  2. Craft an authorization URL with a wrong scope and the attacker's redirect URI.
  3. Send the URL to a victim; the provider redirects to attacker.com due to the error.

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 websites to let you log in using another service. When something goes wrong during login, the service is supposed to send you back to the app you came from. This report shows that if you deliberately cause an error, the service will still send you to any website you registered as an app, which can be used to trick people into visiting malicious sites.

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.

More by Antonio Sanso

View all

3 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.