Incorrect param parsing in Digits web authentication
The Digits web authentication client-side parameter parser only splits on ampersand, while the server also accepts semicolons as delimiters. An attacker could craft a URL that bypasses host validation and redirects the OAuth flow to a domain they control, potentially stealing the victim's OAuth credentials.
Originally disclosed on HackerOne
- Triaged in 2 hours
- Fixed in 5 months
- Paid in 4 days
- Disclosed after 2.4 years
Hi, I would like to report an issue on Digits web authentication which allows attackers to retrieve the OAuth credential data of an application victims authorized.
#Detail Digits web authentication has strict validation on host and callback_url. On the server side, the values are compared with the registered domain. However, on the client side, the way parameters are parsed has a wrong assumption. Specifically, in https://cdn.digits.com/45ed91c4cf9b6bb7465c27574b16910df8a86d2e_1458327827406/javascripts/popup.js
return window.location.search.slice(1).split("&").forEach(function(e) {
var n = e.split("=");
t[n[0]] = window.unescape(n[1])
})
The above code snippet is responsible to convert query string into parameters, which assumes that the param delimiter has to be ampersand (&). In fact, the server side also accepts semi-colon (;) as param delimiter. For example:
is the same as
This creates a problem because from the server's perspective, a=b;c=d is two different parameters a and c, while the client thinks there is only one parameter a with value b;c=d. Attacker can evade the validation by append ;@attacker.com in the corresponding param. Such bypass looks like this:
The server side thinks the host parameter is https://www.periscope.tv, while for client side it is https://www.periscope.tv;@attacker.com.
The funky URL in browser perspective looks like this:
https://www.periscope.tv;@attacker.com
--------\ authority /\ hostname /
Therefore attacker successfully control the destination domain to his/her controlled site.
#PoC
- Prepare a Periscope account which is associated with a phone number
- Login to Periscope using the phone number with digits web login flow: https://innerht.ml/pocs/digits-validation-bypass/
- After that your account will be renamed as "Pwn3d"
#Fix In addition to ampersand, also treat semi-colon as param delimiter. A sample patch would be to change
window.location.search.slice(1).split("&")
to
window.location.search.slice(1).split(/[&;]/)
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 client-side JavaScript parser assumed only '&' separates parameters, but the server also accepted ';', creating a parsing mismatch that allowed host validation bypass.
Impact
An attacker could redirect the OAuth flow to a domain they control and retrieve the victim's OAuth credential data.
What the attacker needed
Victim has a Periscope account with a phone number; victim uses Digits web login flow; attacker controls a domain
The fix
The client-side parser should treat both ampersand and semicolon as parameter delimiters, for example by splitting on a regular expression that matches either character.
How it was found
- Prepare a Periscope account associated with a phone number.
- Log in to Periscope using the phone number with the Digits web login flow.
- After that, the account will be 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.
The report shows the check could be fooled by using a semicolon instead of an ampersand in the web address, letting an attacker send the login result to their own site and retrieve OAuth credential data.
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.