Skip to content
XSS Disclosed report Advanced CVE-2026-6755

Firefox 122.01: postMessage event.source validation bypass

A cross-origin page could reach the Function constructor through a window's location object and call postMessage in the context of a different origin, so the receiving page saw a cross-origin window as event.source. An attacker could therefore send messages that pass event.source checks in extensions and web apps that rely on that property.

frsantos9989 Follow

Originally disclosed on Mozilla

  • Fixed in 2.1 years
  • Paid in 2.1 years
  • Disclosed after 2.1 years

(Droping the md report here because I didn't know the original placeholder allowed md)

Firefox 122.01: postMessage event.source validation bypass

Summary

I identified a security vulnerability in Firefox 122.01 that allows sending postMessage from cross-origin sources. This bypasses the expected event.source validation, potentially leading to security risks such as cross-origin actions or data exposure.

By accessing win.location.constructor.constructor of the initial about:blank page, an attacker can execute this.postMessage in the context of the cross-origin page.

Environment

  • Browser Version: Firefox 122.01.
  • Operating System: ZorinOS 6.5.0-17-generic #17~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC

Steps to Reproduce

  1. Host the following HTML page on a server or open it directly in a browser:

    HTML
    <html>
    <body>
        <script>
            win = open("https://mdn.github.io/webextensions-examples/content-script-page-script-messaging.html");
            loc = win.location.constructor.constructor;
            setTimeout(() => {
                loc('return this.postMessage({"direction":"from-content-script","message":"Message from the page"}, "*")')()
            }, 3000)
        </script>
    </body>
    </html>
    
  2. After 3 seconds, observe that a message is sent to the demo extension's page, bypassing the expected event.source validation.

Expected Behavior

The event.source property value should be a ProxyWindow to the same-origin window.

Observed Behavior

The event.source property value is a ProxyWindow to the cross-origin window.

Impact

A threat actor can abuse this behavior to compromise Firefox extensions and web applications that validate the origin of incoming message with the event.source property. This can lead to other client-side vulnerabilities such as Cross-Site Scriping, Prototye Pollution, DOM Clobering...

Recommendations

Block access to the Function constructor of any property of a window loading about:blank page if it will be replaced by a cross-origin document.

The original report as published on Mozilla's Bugzilla, by frsantos9989. 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 Function constructor remained reachable through a window's location object while that window was still about:blank, letting script run in the context of the cross-origin document that later replaced it.

Impact

Extensions and web apps that trust event.source could be tricked into acting on messages from another origin, which the author says may lead to client-side issues such as cross-site scripting, prototype pollution or DOM clobbering.

What the attacker needed

Firefox 122.01; victim visits attacker page; receiver trusts event.source

The fix

Access to the Function constructor through properties of a window that loads about:blank and is later replaced by a cross-origin document should be blocked.

How it was found

  1. Open a page that opens a cross-origin page in a new window.
  2. Reach the Function constructor through the new window's location object.
  3. After a delay, run code that calls postMessage from that context.
  4. Observe the message arriving with a cross-origin window as event.source.

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.

Web pages can open other pages and talk to them with a messaging feature called postMessage. Receivers often check who sent a message by looking at event.source, which should point at the sender's own window. Here the sender found a way to make that check point at the wrong window, so a message from one site looked like it came from another.

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.