Skip to content
Open redirect Disclosed report Advanced

Bypassing callback_url validation on Digits

Digits validated the callback_url hostname before URL-encoding, but a non-ASCII character in the authority part was later converted to a question mark, shifting the hostname to the attacker's domain. An attacker could redirect a victim's OAuth credentials to their own site and take over the victim's account.

File Descriptor Follow

Originally disclosed on HackerOne

  • Triaged in 5 hours
  • Fixed in 33 hours
  • Paid in 7 days
  • Disclosed after 7 months

Hi, I would like to report an issue in Digits which allows attacker to bypass the callback_url validation of an application and thus takeover an account.

#Detail Digits is a part of the Fabric SDK which offers phone-based sign in. It also provides web login flow. In the navigation-based authentication flow, the OAuth credential data is passed to the specified callback URL (callback_url) after a user granted access to an application using HTTP 302 redirect. This parameter is supposed to be validated to match the registered domain of the application. Here's an example for Periscope:

https://www.digits.com/login?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https%3A%2F%2Fwww.digits.com&callback_url=https://www.periscope.tv

callback_url=https://www.periscope.tv matches the application's registered domain, so no problem.

If we modify it:

https://www.digits.com/login?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https%3A%2F%2Fwww.digits.com&callback_url=https://example.com

callback_url=https://example.com does not match the application's registered domain, thus the request is rejected.

Now, it is noticed that the validation is rather loose. For example, it parses the URL and compares only the hostname part. In other words, a URL with authority part is allowed (e.g. callback_url=https://[email protected]). It is still a solid validation because the hostname part is correctly handled (something like https://whatever@www.periscope.tv won't work).

However, it is discovered that when outputting a non-ASCII character in the header, it will get converted to a question mark (?). This happens after the validation. Thus, attacker can bypass the validation by putting his/her own domain followed by a non-ASCII character in the authority part.

Here's how it works:

Input:

https://attacker.com%[email protected]
--------\  authority   /\   hostname   /

The URL is parsed and passes the validation because the hostname matches the registered domain.

Output:

https://[email protected]
--------\ hostname /-\     query     /

Since the URL is outputted in the location header, %ff which is non-ASCII is converted. Now suddenly the hostname becomes attacker.com and everything after the question mark becomes the query part. Finally the victim will be redirected to attacker's site with victim's account's OAuth credential.

#Impact It affects every application that has integrated Digits, and even official application (Periscope). Attacker can abuse the flaw to login to victim's account on the affected applications.

#PoC

  1. Prepare a Periscope account which is associated with a phone number
  2. Login to Periscope using the phone number with digits web login flow: https://www.digits.com/login?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https%3A%2F%2Fwww.digits.com&callback_url=https://innerht.ml%[email protected]
  3. After that your account will be renamed as "Pwn3d"

Video demo: https://vimeo.com/150671313 (password: token)

#Fix The callback_url should discard the authority part before outputting.

The original report as published on HackerOne, by filedescriptor. 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 callback_url was validated on the parsed hostname, but a non-ASCII character in the authority part was later converted to a question mark when written to the Location header, changing the effective hostname after validation.

Impact

Every application integrated with Digits, including Periscope, could be affected, allowing an attacker to log in to a victim's account.

What the attacker needed

Victim clicks a crafted login link; victim has a Digits-linked account

The fix

The callback_url should discard the authority part before outputting it.

How it was found

  1. Prepare a Periscope account linked to a phone number.
  2. Start the Digits web login flow with a callback_url that has the attacker's domain, a non-ASCII character, and the legitimate domain in the authority part.
  3. After login, the victim is redirected to the attacker's site with the OAuth credential, and the account is renamed to 'Pwn3d'.

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.

Digits is a phone-based login service. When a user logs in, the service sends them back to the application's website with a special code that proves who they are. The report shows that by adding a strange character to the web address, an attacker could trick the service into sending that code to the attacker's website instead, letting the attacker log in as the victim.

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 File Descriptor

View all

20 more disclosed reports, best first.

More from X / xAI

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.