Show Select Option on any Website
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: fazim.pentester, Assigned: edgar)
References
Details
(Keywords: csectype-spoof, reporter-external, sec-moderate, Whiteboard: [client-bounty-form][adv-main133+][adv-esr128.5+])
Attachments
(3 files, 3 external files, 1 obsolete file)
Bug 1875824 was not properly fixed by Bug 1877969, and there is a workaround. A malicious website could use other methods, such as onmousedown, to bypass the security measures.
Steps to Reproduce:
- Download the poc.html file.
- Open the poc.html file in firefox for testing.
Tested on latest Nightly build version: 130.0a1 (2024-07-23) (64-bit), OS: Windows 11
| Reporter | ||
Comment 1•2 years ago
|
||
Video demo.
| Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 2•2 years ago
|
||
The severity field is not set for this bug.
:peterv, could you have a look please?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Comment 3•2 years ago
•
|
||
Is this addressed by bug 1909163 and bug 1907032?
Comment 4•2 years ago
|
||
Looks like my fix in bug 1909163 is incomplete, for starters...
Comment 5•2 years ago
|
||
Is this addressed at this point, in the latest beta builds? I expect so...
| Reporter | ||
Comment 6•2 years ago
|
||
Just tested on the latest beta build; the bug still exists.
Comment 7•2 years ago
|
||
I can actually still reproduce this issue as well. However sometimes the POC now fails for me. It seems like it only shows the popup on google the first time after reloading.
Comment 8•2 years ago
|
||
(In reply to Tom Schuster (MoCo) from comment #7)
I can actually still reproduce this issue as well. However sometimes the POC now fails for me. It seems like it only shows the popup on google the first time after reloading.
There's a race of some kind. Also, beta 8 does not yet have the patch from bug 1907032. But it seems like on Nightly in this case we fire onLocationChange before we open the select (at least on my machine), and then presumably when the select opens we also still haven't made the BC fully background so it also passes the checks from 1907032.
What I don't understand is why the user activation bits don't stop this - I would have expected the window.open to consume user activation for the mousedown and thus click, and then to just not bother opening the popup at all. Why does that part not work?
| Reporter | ||
Comment 9•2 years ago
|
||
Yes, I get the same behavior too. The select option only shows the first time, and we need to reload the page to see it again.
I also tested the other bug, Bug 1909529, and it has been addressed, but this one is still present in the latest beta version.
(In reply to :Gijs (he/him) from comment #8)
What I don't understand is why the user activation bits don't stop this - I would have expected the
window.opento consume user activation for the mousedown and thus click, and then to just not bother opening the popup at all. Why does that part not work?
Is mousedown not considered for consuming user activation?
Comment 10•2 years ago
|
||
(In reply to :Gijs (he/him) from comment #8)
(In reply to Tom Schuster (MoCo) from comment #7)
I can actually still reproduce this issue as well. However sometimes the POC now fails for me. It seems like it only shows the popup on google the first time after reloading.
There's a race of some kind. Also, beta 8 does not yet have the patch from bug 1907032. But it seems like on Nightly in this case we fire
onLocationChangebefore we open the select (at least on my machine), and then presumably when the select opens we also still haven't made the BC fully background so it also passes the checks from 1907032.What I don't understand is why the user activation bits don't stop this - I would have expected the
window.opento consume user activation for the mousedown and thus click, and then to just not bother opening the popup at all. Why does that part not work?
A bunch of people have moved on... at a guess, Masayuki, can you take a look at why this particular poc still reproduces in some cases?
Comment 11•2 years ago
|
||
Well, showing the popup is handled as a default action of mousedown. That runs after the onmousedown which opens another tab. I don't know whether window.open is handled synchronously or asynchronously. Anyway, the internal event handler requests that to parent process synchronously and update the state in content process immediately. As far as I've checked, mElement->OwnerDoc()->IsVisible() returns true even when this bug is reproduced at HTMLSelectEventListener::MouseDown. And also, it seems that mElement is not focused at the method. So, could be focus and blur may be canceled by changing the tab in some conditions?
Comment 12•2 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #11)
Well, showing the popup is handled as a default action of
mousedown. That runs after theonmousedownwhich opens another tab. I don't know whetherwindow.openis handled synchronously or asynchronously.
So can/should we check for user activation having already been consumed in this internal handler, and would that fix things? (ie does window.open consume user activation synchronously in the child process)
I'm also not sure I understand why we consume user activation when calling showPicker but not when the user just clicks the item.
Comment 13•2 years ago
|
||
(In reply to :Gijs (he/him) from comment #12)
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #11)
Well, showing the popup is handled as a default action of
mousedown. That runs after theonmousedownwhich opens another tab. I don't know whetherwindow.openis handled synchronously or asynchronously.So can/should we check for user activation having already been consumed in this internal handler, and would that fix things? (ie does
window.openconsume user activation synchronously in the child process)
Window opening / pop-up blocking code is quite old, so it doesn't surprise me too much if it doesn't interact as expected with the modern user activation logic. I unfortunately am not super familiar with the expected behaviour here but I do worry about changing how activation interacts with window opening could have webcompat risks.
Based on https://searchfox.org/mozilla-central/rev/1b90936792b2c71ef931cb1b8d6baff9d825592e/docshell/base/BrowsingContext.cpp#2231, it looks like sometimes popup abuse level can consume user interaction, but perhaps not reliably? It also wouldn't surprise me too much if this is bypassed for link click default handlers at least sometimes.
Comment 14•2 years ago
|
||
Unfortunately, I'm not familiar with user activation too and I got lost now. I was thinking that the better behavior is that the dropdown should be closed when switched to the new tab. So, I was thinking that if the tab switch occurs during opening the dropdown, the dropdown should be closed immediately.
Comment 15•2 years ago
|
||
(I will try to give this another look next week)
Updated•2 years ago
|
Comment 16•2 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #14)
Unfortunately, I'm not familiar with user activation too and I got lost now. I was thinking that the better behavior is that the dropdown should be closed when switched to the new tab. So, I was thinking that if the tab switch occurs during opening the dropdown, the dropdown should be closed immediately.
Yes, that should also happen - but it would appear there is a race between when we check if the tab for which the dropdown is being opened is in the background, and when we try to close open popups when switching tabs.
Comment 17•2 years ago
|
||
Apparently even when the dropdown is hidden successfully, this doesn't actually involve tabspecific at all. To be fair, it probably wouldn't work anyway, because SelectParentHelper.open seems to happen after XULBrowserWindow.onLocationChange. The reason the popup is closed at least sometimes, is actually the Forms:BlurDropDown-Pong message handler.
Comment 18•2 years ago
•
|
||
Olli is currently changing some pop-up blocking behavior, and plans to enable https://bugzilla.mozilla.org/show_bug.cgi?id=1911736 soon. Not quite sure how relevant his work relates here though. Adding him to the CC list and see if he has other things to add.
| Assignee | ||
Comment 19•2 years ago
|
||
(In reply to :Gijs (he/him) from comment #12)
I'm also not sure I understand why we consume user activation when calling
showPickerbut not when the user just clicks the item.
The spec does not clearly define the behavior when the user clicks on the <select> element. And other browsers do not check or consume the user activation in this case, either. I worry that changing this might cause web-compatibility problem unless other browsers adopt the same behavior. I file https://github.com/whatwg/html/issues/10701.
Checking the user activation can address this case, but we still have a race problem if SelectParentHelper.open is triggered after we attempt to close open popups while switching tabs in other possible scenarios. Fixing the race on select popup seems the proper solution to me.
| Assignee | ||
Comment 20•2 years ago
|
||
Comment 21•2 years ago
|
||
Comment 22•2 years ago
|
||
Backed out for causing dt & bc failures @ browser_html_options_ui.js / browser_webextension_dropdown.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/df405c12e68e5b31c08e237aeb0a50fcf28590b1
Push with failures
Failure log -> toolkit/mozapps/extensions/test/browser/browser_html_options_ui.js | Test timed out
Failure log ->browser_webextension_dropdown
Comment 23•2 years ago
|
||
Comment 24•2 years ago
|
||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Comment 25•2 years ago
|
||
:edgar could you add beta and esr128 uplift requests on this?
It grafts cleanly for both
| Assignee | ||
Comment 26•2 years ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D225706
Updated•2 years ago
|
Comment 27•2 years ago
|
||
beta Uplift Approval Request
- User impact if declined: The selection dropdown can appear from a background tab, which might confuse the user
- Code covered by automated testing: no
- Fix verified in Nightly: yes
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: follow the STR in https://bugzilla.mozilla.org/show_bug.cgi?id=1909535#c0
- Risk associated with taking this patch: Low
- Explanation of risk level: The patch disallows opening a selection dropdown from an inactive window or tab, so it should be safe.
- String changes made/needed: None
- Is Android affected?: no
| Assignee | ||
Comment 28•2 years ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D225706
Updated•2 years ago
|
Comment 29•2 years ago
|
||
esr128 Uplift Approval Request
- User impact if declined: The selection dropdown can appear from a background tab, which might confuse the user
- Code covered by automated testing: no
- Fix verified in Nightly: yes
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: follow the STR in https://bugzilla.mozilla.org/show_bug.cgi?id=1909535#c0
- Risk associated with taking this patch: Low
- Explanation of risk level: The patch disallows opening a selection dropdown from an inactive window or tab, so it should be safe.
- String changes made/needed: None
- Is Android affected?: no
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 30•2 years ago
|
||
| uplift | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 31•2 years ago
|
||
| uplift | ||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 32•2 years ago
|
||
I was able to reproduce this issue on Nightly 130.oa1(2024-07-23)(64 bit) using Windows 10x64.
The bug is verified as fixed(select dropdown is not displayed in background tabs) on Nightly 134.0a1(2024-11-04), Fx Beta 133.0b4(treeherder build) and Fx esr 128.5.0(treeherder build) using Windows 10x64, Windows 11, MacOS 13.2.1 and Ubuntu 24.10.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 33•1 year ago
|
||
We downgraded the severity of bug 1909529 to sec-low because that PoC only worked if people disabled the popup blocker. This version of the spoof showed it was possible to work around that restriction, but the spoofing capabilities are still pretty low.
Updated•1 year ago
|
Comment 34•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Description
•