XSS Via Qr Code
A hidden QR code scanner page echoed the decoded QR text into the page as raw HTML inside a span element. An attacker could craft a QR code containing HTML that runs script when scanned, giving cross-site scripting.
Published on medium.com
{{media:0}}
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the scanner output was inserted into the page as HTML rather than as plain text, so markup in the decoded content was rendered and executed.
Impact
An attacker could run script in the browser of anyone who scans a malicious QR code on the site, though the write-up only demonstrates an alert and does not show further harm.
What the attacker needed
Victim scans a crafted QR code; attacker can get the code in front of the victim
How it was found
- Find an unexpected index page during reconnaissance that hosts a QR code scanner
- Generate a QR code containing plain text and scan it to see how the output is displayed
- Inspect the page and note the decoded text is placed inside an HTML span tag
- Create a QR code whose text contains HTML with an event handler and scan it
- Observe the script executing as an alert
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 write-up has not been written yet. The Original tab links to the source.
A QR code is just a square barcode that holds text, often a web address. This site read the text from a scanned code and placed it straight into the web page as if it were part of the site's own code, so text containing HTML tags was treated as real markup. That let a crafted code run JavaScript in the browser of whoever scanned it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.