Skip to content
Info disclosure Disclosed report Intermediate

Twitter ID exposure via error-based side-channel attack

A user's Twitter ID could be confirmed by loading a developer API endpoint as a script and observing whether it loaded or errored, because the endpoint returned a 403 for IDs other than the logged-in user's. An attacker who knew a victim's Twitter ID could therefore identify the victim when they visited a malicious website.

terjanq Follow

Originally disclosed on HackerOne

Bounty$1,470 Medium 5.7 View original
  • Triaged in 9 days
  • Fixed in 27 days
  • Paid in 10 days
  • Disclosed after 2 months

Twitter ID Confirmator

Summary

Recently I discovered a privacy-related vulnerability in Twitter. An attacker exploiting this vulnerability can identify a user when they visit a malicious website.

Description

Threat model: The attacker knows the victim’s Twitter ID/username and aims at identifying them when visiting one of the controlled websites such as a blog or a news website. Another goal that the attacker could wish to achieve is to identify a user out of a group of potential target users.

Vulnerability I found out that a user-related content is being loaded when visiting the developer tools and that is https://developer.twitter.com/api/users/USER_ID/client-applications.json. If the USER_ID is different from the ID of a currently logged in user the error 403 will be returned with the following JSON output

JSON
{"error":{"message":"You are not logged in as a user that has access to this developer.twitter.com resource.","sent":"2019-03-06T01:20:56+00:00","transactionId":"00d08f800009d7be"}}. 

Otherwise, a list of created apps will be displayed (the list will be empty if the user didn't create any app) and no error will be thrown.

It is possible to detect whether the file returned an error or not by a simple onload/onerror event handlers. The example code is shown in #Steps-to-reproduce

Steps to reproduce

  1. Visit any website
  2. Execute the following javascript code while replacing Your ID with an ID you want to test for
JavaScript
var id = 'Your ID'
var script = document.createElement('script');
script.src = `https://developer.twitter.com/api/users/${id}/client-applications.json`;

script.onload = () => console.log('ID match');
script.onerror = e => console.log('ID mismatch');
document.head.appendChild(script);

These steps have been implemented in the Proof of Concept: https://terjanq.github.io/Bug-Bounty/Twitter/confirming-username/poc.html

PoC in action: https://youtu.be/_S_ImYPvvhc

Impact

An attacker can expose the identity of Twitter users when they visit a prepared for that purpose website.

The original report as published on HackerOne, by terjanq. 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 developer API endpoint returned a distinguishable error (403) for IDs other than the logged-in user's, allowing a cross-origin script load to act as an oracle for the user's identity.

Impact

An attacker could expose the identity of Twitter users when they visit a prepared website.

What the attacker needed

Victim is logged in to Twitter; victim visits attacker-controlled site; attacker knows victim's Twitter ID

How it was found

  1. Visit any website.
  2. Run JavaScript that creates a script element pointing to the developer API endpoint with the ID to test.
  3. Attach onload and onerror handlers to log whether the ID matched or not.
  4. Append the script to the document head to trigger the request.

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.

When you log into a website, your browser can load resources from other sites. This report found that a Twitter developer page would load successfully only if the ID in the URL matched the logged-in user, and would fail otherwise. By loading that page as a script, a malicious site could tell whether you were the person it was looking for.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by terjanq

View all

2 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.