Skip to content
XSS Disclosed report Beginner CVE-2019-17003

Improper parsing of QR codes in address bar leads to XSS

A QR code generator website allowed users to create QR codes containing javascript: URIs. When a victim scanned such a QR code with Firefox, the browser executed the JavaScript in the context of the QR code generator's domain, allowing the attacker to steal cookies and data from that domain.

Nikhil Follow

Originally disclosed on Mozilla

  • Fixed in 3 months
  • Paid in 4 months
  • Disclosed after 3 months
Text
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Steps to reproduce:

1. Goto URL https://www.the-qrcode-generator.com/
2. Click on tab `free text`
3. Paste the following exploit to generate QR code
---------------------------------------------------------
javascript:fetch('https://www.google.com/').then(res=>res.text()).then(data=>alert(data));
---------------------------------------------------------
4. Open firefox and scan the QR code generated by the website
5. You will triage javascript code execution in reference to google.com

Video POC: https://drive.google.com/file/d/1G71vasB7MYSUClXDmsx5gV_dYFnLn1Mt/view


Actual results:

This results in stealing users current cookies and data on the current domain by just scanning the QR


Expected results:

javascript URI's should not be allowed, or some kind of warning message should be displayed.

The original report as published on Mozilla's Bugzilla, by Nikhil. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 QR code generator did not validate or sanitise the input before encoding it into a QR code, and Firefox executed the javascript: URI when scanned.

What the attacker needed

Victim uses Firefox; victim scans attacker's QR code

How it was found

  1. Go to the QR code generator website.
  2. Select the free text tab.
  3. Enter a javascript: URI as the text to encode.
  4. Generate the QR code.
  5. Scan the QR code using Firefox.
  6. Observe JavaScript execution in the context of the website's domain.

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 QR code is just a picture that stores text, often a web address. Some browsers, like Firefox, will run text that starts with 'javascript:' as code instead of treating it as a harmless link. The website let anyone make a QR code with such code, so scanning it ran the attacker's code on the website's own domain, giving access to the victim's session there.

What is XSS?

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

More from Mozilla

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.