Skip to content
XSS Disclosed report Intermediate

[dev.twitter.com] XSS and Open Redirect

The dev.twitter.com redirect endpoint mishandled the Request-URI differently when building the Location header and the fallback link on the page. An attacker could craft a link that produced an open redirect in several browsers, and in Firefox a javascript: link that executed script in the dev.twitter.com origin.

bobrov Follow

Originally disclosed on HackerOne

Bounty$1,120 Medium View original
  • Triaged in 8 days
  • Fixed in 43 days
  • Paid in 28 days
  • Disclosed after 44 days

Summary by the researcher

http://blog.blackfan.ru/2017/09/devtwittercom-xss.html

The report

Description

XSS via Request-URI which requires user interaction. The vulnerability is caused by the difference in the Request-URI processing in the Location header and in the link on the page. By creating an incorrect port in the link on the Location header, you can block the redirection for the FireFox browser. Next, using the difference in the processing, generate a "javascript" link on the page.

PoC: Open Redirect

Browsers: Chrome, FireFox, Opera

https://dev.twitter.com/https:/%5cblackfan.ru/

HTTP Response:

HTTP
HTTP/1.1 302 Found
connection: close
...
location: https:/\blackfan.ru

PoC: XSS

Browsers: FireFox Steps to reproduce: Open and click the link

https://dev.twitter.com//x:1/:///%01javascript:alert(document.cookie)/

HTTP Response:

HTTP
HTTP/1.1 302 Found
connection: close
...
location: //x:1/://dev.twitter.com/javascript:alert(document.cookie)
...


<p>You should be redirected automatically to target URL: <a href="javascript:alert(document.cookie)">javascript:alert(document.cookie)</a>.  If not click the link.
Screenshot_at_20-24-11.png
Screenshot_at_20-24-11.png From the original on HackerOne

The original report as published on HackerOne, by bobrov. 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 redirect handler parsed the Request-URI inconsistently for the Location header and for the HTML fallback link, allowing a crafted path to become a javascript: URL in the link.

Impact

An attacker could redirect users to arbitrary sites in Chrome, Firefox and Opera, and in Firefox could run script in the dev.twitter.com origin once the victim clicked the fallback link.

What the attacker needed

Victim clicks a crafted link; victim uses Firefox for the XSS variant

How it was found

  1. Craft a URL with an incorrect port so Firefox blocks the redirect.
  2. Use the processing difference to make the page's fallback link a javascript: URL.
  3. Open the crafted link in Firefox and click the fallback link.

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.

A web server often redirects you to another page and also shows a 'click here if not redirected' link. This site built those two things from the same input in slightly different ways. By choosing a strange URL, an attacker could make the redirect go anywhere, and in Firefox make the fallback link run JavaScript in the site's own page.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by bobrov

View all

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

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.