Bypassing Digits bridge origin validation
The Digits bridge proxy validated the host parameter against the registered domain but did not check that the embedding page was from that domain. An attacker could embed the bridge with a legitimate consumer key and host, then use postMessage to retrieve OAuth credentials and log into the victim's account without interaction.
Originally disclosed on HackerOne
- Triaged in 2 days
- Fixed in 41 days
- Paid in 16 days
- Disclosed after 16 months
Hi, I would like to report an issue in the bridge proxy in Digits which allows attacker to retrieve the OAuth credential data of an application victims authorized.
#Detail In the Digits Web SDK, the method getLoginStatus can be used to retrieve the OAuth credential data of an application if the user has already logged in Digits and authorized the app. The way it works is to inject an hidden iframe (I call it bridge because the URL is https://www.digits.com/bridge) which acts like a proxy into the webpage and communicate using postMessage. Once the bridge receives the getLoginStatus command, it will make an AJAX request to /login_status and the response will contain the OAuth credential data of the user of an application. Then, the bridge will send back the data via postMessage to parent window.
For example:
+----------------------------------------------------------------------------------+
| https://www.periscope.tv/ |
+----------------------------------------------------------------------------------+
| |
| +----------------------------------------------------------------------------+ |
| | https://www.digits.com/bridge?consumer_key=.&host=https://www.periscope.tv | |
| +----------------------------------------------------------------------------+ |
| | | |
| | ^ + | |
| +----------------------------------------------------------------------------+ |
| | | |
| | | |
| | | |
| | | |
| | | |
| + v |
| getLoginStatus OAuth Credential |
| |
+----------------------------------------------------------------------------------+
If https://www.periscope.tv/ invokes Digits.getLoginStatus(), then an iframe will be injected where the host parameter is the invoker origin.
There's a protection in place which validates whether the host parameter provided matches the application registered domain. For example, /bridge?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https://www.periscope.tv passes while /bridge?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https://attacker.com fails. This prevents others to use the same consumer_key to pretend to be the legit application to issue the command.
However, there is no validation to check whether the page which embeds the bridge proxy is from the registered domain. In other words, attacker can manually embed /bridge?consumer_key=9I4iINIyd0R01qEPEwT9IC6RE&host=https://www.periscope.tv into his/her webpage and issue command on behalf of the legit application.
#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. In addition, this attack does not require user interaction. The only prerequisite is that the victim has already logged in Digits and authorized the application.
#PoC
- Prepare a Periscope account which is associated with a phone number, and make sure you have logged in Digits (https://www.digits.com/signin) with that number
- Go to http://innerht.ml/pocs/digits-bridge-origin-validation-bypass/
- Wait for a while
- You Periscope account will be renamed as "Pwn3d"
Video demo: https://vimeo.com/151646523 (password: proxy)
And as always, since it does not require user interaction, it can be put into a player card to achieve maximum stealthiness.
#Fix It would be ideal to employ CORS instead of postMessage + proxy for that purpose. An alternative fix would be to check whether the page embedding the bridge proxy is from the registered domain by comparing referrer (pretty unsound though).
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
Impact
An attacker could log into the victim's account on any application that integrated Digits, including official apps like Periscope, without user interaction, provided the victim had already logged in to Digits and authorised the application.
What the attacker needed
Victim logged in to Digits; victim authorised the target application; attacker knows the consumer key
The fix
The report suggests using CORS instead of postMessage with a proxy, or alternatively checking the referrer to verify the embedding page's domain, though the latter is considered unsound.
How it was found
- Prepare a Periscope account linked to a phone number and log in to Digits with that number.
- Visit the attacker's proof-of-concept page.
- Wait for the attack to complete.
- The Periscope 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 login service. A website can include a hidden frame from Digits to ask if you are logged in. The frame checks that the website's address matches the app's registered address, but it does not check who is embedding the frame. So an attacker can put the same frame on their own page and ask for your login data.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.