Skip to content
XSS Disclosed report Intermediate CVE-2019-15782

Stored XSS in localhost:* via integrated torrent downloader

The filename of a downloaded torrent was not sanitised, so a crafted torrent could place a file whose name contained script into the browser's local download server. An attacker could then run arbitrary JavaScript on the localhost origin, which could steal data from any other service later started on the same port.

ryotak Follow

Originally disclosed on HackerOne

Medium 5.0 View original
  • Triaged in 2 days
  • Fixed in 2 days
  • Disclosed after 30 days

Summary by the researcher

The original PoC that I used in the report doesn't work anymore because my domain (exec.ga) is expired.

The report

Summary:

Due to filename of downloading torrent file isn't sanitized, an attacker is able to execute arbitrary JavaScript on localhost:* by abusing crafted torrent file.

Products affected:

  • Brave 0.68.131 Chromium: 76.0.3809.100 (Official Build)

Steps To Reproduce:

  1. Open https://exec.ga/browser/brave/xss.torrent in Brave Browser.
  2. Click "Start Torrent" button
  3. Copy link address of "Save File" button.
  4. Paste it to URL bar with only hostname and port (e.g. http://localhost:8080).
  5. Alert will be popped up.

Note: Since it can be embedded with iframe (and it's possible to brute force port number), Steps after 2 won't be needed in real attack.

Video PoC

PoC.mp4 From the original on HackerOne

Impact

Attacker will be able to store arbitrary JavaScript on localhost:* with service worker, so if victim run any software on same port after attack, any information in the website that on same port can be stolen.

The original report as published on HackerOne, by ryotak. 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 torrent filename was written into the local download page without sanitisation, allowing script to be stored and executed on the localhost origin.

Impact

An attacker could store script on the localhost origin with a service worker, so if the victim later runs software on the same port, information from that site could be stolen; the report notes the page can be framed and the port brute forced, so the later manual steps may not be needed.

What the attacker needed

Brave 0.68.131 on desktop; victim opens a crafted torrent link; victim starts the torrent download

How it was found

  1. Open the crafted torrent link in the Brave browser.
  2. Click the button to start the torrent.
  3. Copy the link address of the save-file button.
  4. Paste it into the URL bar keeping only the hostname and port.
  5. The script runs and an alert appears.

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 download a torrent, the browser serves a small local web page on localhost. This report found the torrent's filename was used there without cleaning, so a name containing code could run as a script. Because that page is on your own machine, the script could later read data from other programs using the same port.

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 ryotak

View all

23 more disclosed reports, best first.

More from Brave Software

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.