Skip to content
DoS Disclosed report Intermediate CVE-2022-42929

Persistent Popup DoS with window.print

Calling window.print() from within a beforeprint event handler causes Firefox to open new browser windows without popup permission, and these windows can be restored by session restore, leading to a persistent denial of service. An attacker could use this to spawn windows indefinitely, exhausting memory and making the browser unusable.

Andrei Enache Follow

Originally disclosed on Mozilla

  • Fixed in 10 days
  • Paid in 14 days
  • Disclosed after 10 days
Text
I have been testing the window.print functionality in Firefox. At some point, I found that running two print() calls simultaneously in the console (without closing the dialog after the first one) leads to a new browser window opening without any popup permissions. The tab inside the new window is mostly broken, for example it cannot be redirected, but it does get restored by session restore function when quitting firefox.

After a bit of testing different methods to reproduce the parallel nature of this bug within single-threaded JavaScript, I ended up the the following (warning: will keep spawning windows indefinitely, in my case leading to OOM):
'''
window.addEventListener('beforeprint', (event) => {
  print()
});
print()
'''
This denial of service is persistent in multiple ways; if the malicious website remains open after session restore, or if the windows open by the malicious website are kept in session restore. When testing this it was difficult to stop the browser because the new windows were stealing focus, exacerbating the issue. Therefore this can lead to persistent full denial of service of browser functionality in the worst case.

This has been tested on Nightly, Mozilla Firefox 106.0a1 20220906092849 20220906092849.

The original report as published on Mozilla's Bugzilla, by Andrei Enache. 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 a re-entrancy flaw in Firefox's print handling: calling print() from within the beforeprint event handler triggers a second print operation while the first is still in progress, causing an unexpected new window to be created without popup permission checks.

Impact

An attacker could cause a persistent denial of service of the browser by spawning windows indefinitely, potentially leading to out-of-memory and making the browser difficult to stop due to focus stealing.

What the attacker needed

Victim visits a malicious website; browser is Firefox (tested on Nightly 106.0a1)

How it was found

  1. Open Firefox and navigate to a page that runs the malicious script.
  2. The script adds a beforeprint event listener that calls print().
  3. The script then calls print() once to trigger the beforeprint event.
  4. The beforeprint handler calls print() again, causing a new window to open without permission.
  5. The new windows keep spawning, stealing focus and eventually causing out-of-memory.

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 website can ask the browser to print a page, which normally shows a print dialog. If the page also listens for the moment just before printing and asks to print again, Firefox gets confused and opens a new window without asking the user for permission. Because these windows are saved when the browser restarts, the problem can continue even after closing the original site, eventually using up all memory and making the browser unusable.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.