Re-run window.open with same windowName allow focus stealing can be used to overlap fullscreen notification toast
Repeatedly calling window.open with the same window name lets a child popup regain focus without user activation, and this focus stealing can be used to overlap the fullscreen notification toast. An attacker could use this to obscure the browser's fullscreen warning.
Originally disclosed on Mozilla
- Fixed in 13 days
- Paid in 13 days
- Disclosed after 13 days
Created attachment 9297325 testcase.bundle.html
After launch child popup window with window.open then re-run window.open with same windowName the child window able to repeatedly gain focus without requiring user click activation. With that method I found the child window popup able to overlap another popup fullscreen notification toast.
When run this on mozregression it point to this pushlog:
17:09.62 INFO: Last good revision: 566f81bfa373512b41c1a47962e21a06078d7bf8 (2021-02-08)
17:09.62 INFO: First bad revision: 89c5f958a3ac4795109acf1f9dff1c8026bb82fe (2021-02-09)
17:09.62 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=566f81bfa373512b41c1a47962e21a06078d7bf8&tochange=89c5f958a3ac4795109acf1f9dff1c8026bb82fe
One of the pushlog that has window.open keyword is Take focus from window.open etc even if we're already active but not in the active window. On nsDocShell.cpp I've revert the shouldTakeFocus code to the old one, when re-run the window.open the child window wouldn't able to gain focus.
Tested on:
- Firefox 105.0.2 (64-bit) on Arch Linux (KDE X11)
- Firefox 105.0.2 (64-bit) on Arch Linux (KDE Wayland)
- Firefox 105.0.2 (64-bit) on Ubuntu 22.04.1 LTS (Wayland)
- Firefox Nightly 107.0a1 (2022-10-05) (64-bit) on Arch Linux (KDE X11)
- Firefox Nightly 107.0a1 (2022-10-05) (64-bit) on Arch Linux (KDE Wayland)
Steps to reproduce:
- Visit attached testcase.bundle.html on Linux OS
- Click "Launch stealFocusWindow"
- Click "Launch requestFullscreenWindow"
- Click "requestFullscreen" on child popup window
- Fullscreen notification toast will be overlapped with child window
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 focus-handling change in the browser's document shell code (nsDocShell) that lets a re-issued window.open with an existing window name take focus even when the window is not active.
Impact
A popup could repeatedly steal focus and overlap the fullscreen notification toast, potentially hiding the browser's fullscreen warning from the user.
What the attacker needed
Victim visits a malicious page; Linux desktop; user clicks launch buttons
The fix
The report does not state a shipped fix; reverting the focus-taking change in the document shell code stopped the popup from regaining focus.
How it was found
- Open the attached test page on Linux.
- Click the button that launches the focus-stealing window.
- Click the button that launches the fullscreen request window.
- Trigger fullscreen on the child popup.
- Observe the child window overlapping the fullscreen notification toast.
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.
When a website opens a popup window, the browser normally only lets that popup take focus if the user has just interacted with the page. This report shows that calling the open function again with the same window name lets the popup grab focus repeatedly without any click. Because the browser shows a warning banner when a page goes fullscreen, an attacker could cover that warning with the popup.
What is UI spoofing?
The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.