-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve protection against application windows with the "override redirect" flag #4705
Comments
The 2px border is what is enforced to make user notice it's VM window. Ideally we wouldn't allow such windows (evading window manager) at all, but unfortunately this breaks a lot of things, basically makes the system unusable. Think of problems like menus opening in a totally different place on the screen, or even below the current window, or closing immediately as application notice it doesn't have focus anymore. Some workaround would be to limit maximum size of such windows. Like half of the screen at most. This isn't bulletproof (one could use two or more windows to cover the screen), but should be easier to notice. But also this may lead to breaking some applications (for example maximized Firefox can have quite a big drop down menus for history or open tabs). I think the most problematic thing is those windows generally stays on top, even if you switch focus with alt+tab. I haven't found any way to avoid this (while preserving other "override redirect" properties), but maybe I'm missing something? Related: #881 |
Ah, I had read #881 but didn't realize this was an instance of an override redirect window. Some random ideas (not enough to actually fix the problem, so not worth wasting time implementing them to get a half-broken result that can still be circumvented).
|
Could Qubes ensure that an |
That would break many applications, as in many cases the whole reason for using separate window is that it can extend outside of its parent. See for example network manager menu, or basically any menu with sufficiently small application window. |
Could such windows be restricted in some way?
My thoughts:
- Must have a full border, including title
- Must be at least a certain minimum size
- Must be docked to the status bar
- Cannot overlap any windows belonging to a different VM or to dom0
- Cannot overlap the dom0 status bar
- Cannot receive input for at least five seconds after spawning
- The total area of all such windows (from all VMs) cannot exceed 20% of
the screen.
Obviously, windows that are entirely within existing windows owned by the
same VM are exempt.
…On Tue, Jan 15, 2019, 12:44 PM Marek Marczykowski-Górecki < ***@***.***> wrote:
That would break many applications, as in many cases the whole reason for
using separate window is that it can extend outside of its parent. See for
example network manager menu, or basically any menu with sufficiently small
application window.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4705 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGGWBzP8_nZx73xZl8uWCmUXcLS5SkXYks5vDhN7gaJpZM4Z7nwF>
.
|
I recommend you to look for such "override redirect" windows on your system, they are easy to distinguish - have 2px border and no title bar. You'll see most of the legitimate use cases for them violate at least some of the points above... Some examples:
This breaks (all?) combobox widgets, as such title bar would either overlap with the thing you're selecting, or shift the whole thing down (which in many cases make the application close it for some reason).
Try right click anywhere.
Again, right click, near window edge. Or widget menu.
All widget menus
Waiting 5sec before clicking anything in any menu is not a good idea, at least...
This actually may be a good idea. If the criteria is not met, setting "override redirect" flag is rejected and window get normal borders, title bar and is managed by window manager. In many cases such forcing no-override-redirect will break application badly, but maybe those few that abuse it for just "large window" will still work?
This is trivial to bypass - simply create normal window (or windows) below, open new override-redirect window covering them, then close those below (or not). Note also that above/below relation can change - while such window can be perfectly legal at one time, as soon you press alt+tab it's not legal anymore. I wonder how Wayland compositors handle such windows (menus, popups etc). |
I believe those applications are broken on Wayland. Wayland does not allow
applications any control over the location of their windows, and neither
should Qubes. Combo boxes can (and should) be handled by dom0.
On Jan 15, 2019 7:59 PM, "Marek Marczykowski-Górecki" < [email protected]> wrote:
I recommend you to look for such "override redirect" windows on your
system, they are easy to distinguish - have 2px border and no title bar.
You'll see most of the legitimate use cases for them violate at least some
of the points above... Some examples:
- Must have a full border, including title
This breaks (all?) combobox widgets, as such title bar would either overlap
with the thing you're selecting, or shift the whole thing down (which in
many cases make the application close it for some reason).
- Must be docked to the status bar
Try right click anywhere.
- Cannot overlap any windows belonging to a different VM or to dom0
Again, right click, near window edge. Or widget menu.
- Cannot overlap the dom0 status bar
All widget menus
- Cannot receive input for at least five seconds after spawning
Waiting 5sec before clicking anything in any menu is not a good idea, at
least...
- The total area of all such windows (from all VMs) cannot exceed 20% of
the screen.
This actually may be a good idea. If the criteria is not met, setting
"override redirect" flag is rejected and window get normal borders, title
bar and is managed by window manager. In many cases such forcing
no-override-redirect will break application badly, but maybe those few that
abuse it for just "large window" will still work?
Enforcing it may be tricky, possible problems I see now:
- various race conditions when checking area covered by other VMs
- windows can be resized, and I'm not entirely sure if it's possible to
drop override-redirect flag when window is already visible
Obviously, windows that are entirely within existing windows owned by the
same VM are exempt.
This is trivial to bypass - simply create normal window (or windows) below,
open new override-redirect window covering them, then close those below (or
not). Note also that above/below relation can change - while such window
can be perfectly legal at one time, as soon you press alt+tab it's not
legal anymore.
I wonder how Wayland compositors handle such windows (menus, popups etc).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4705 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGGWB29ZVU4xNWXJ6PwCXtrGiPdDhKt5ks5vDnmKgaJpZM4Z7nwF>
.
|
facepalm I was thinking of the widgets that are in the status bar at the top right ( I was obviously confused by what an override redirect window was. That said, I do believe:
|
I can think of other creative ways to deal with this: A) Temporarily flashing a large border + VM label on the perimeter which could last 5-10 sec. Alternately, the border+label could remain visible until the user offers some input, such as a mouse click. This probably requires using some dom0 compositing feature (even if 2D) or some other way to keep the underlying window buffer intact. B) Activating a tooltip for the window in an especially conspicuous way. Or a temporary floating label that is similar to a tooltip. C) Don't force the resolution, but do force positioning of the window. This allows a normal border to be present although part of the window will hang off the edge of the screen. |
( In case anyone uses IntelliJ IDEA (an IDE written in Java): I also had this problem with Qubes 4 + IntelliJ IDEA, and, recently I upgraded to the newest IDEA version, and now, the problem is gone :- ) There're borders around the popup windows in IDEA (those windows which previously didn't have any borders and disappeared in a blink) — I'm wondering if Jetbrains (who develop IDEA) did some change, that solved this issue ... for IntelliJ IDEA only I'd guess; I'd guess other Java apps still have this problem. ) |
Prior to this commit, an application (malicious or not) could create a very large window with the override_redirect attribute set. If the window in question was large enough to prevent the user from interacting with the window manager and/or Qubes OS widgets, it was impossible to terminate the application and/or the hosting VM via regular means. Hence, this commit introduces a simple protection measure against very large windows that have the override_redirect attribute set. The protection works by unsetting the override_redirect attribute for windows that attempt to cover more than 90% of the screen. Doing so allows the user to move and/or minimize the windows in question. When the protection takes effect for the first time, the user is warned once with a persistent notification about what just happened and is informed of a way to disable this protection on a per-VM basis. ("persistent" notifications need to be clicked on to be dismissed.) The protection feature can be disabled via /etc/qubes/guid.conf in dom0, and this commit introduces an example in the aforementioned file along with an explanation to help users. (cherry picked from commit 8d2f822) QubesOS/qubes-issues#4705
@marmarek A few extra suggestions:
|
Which version? Firefox 75 doesn't do that for me.
This is a bad idea, see #4705 (comment)
This is another heuristic that could indeed work, but IMO has much more corner cases (around definition of "overlap"). |
76 if I recall correctly. It only does this if microphone and/or camera are being shared.
What if we just drew the border, without changing anything else?
What about “override redirect windows cannot steal focus from a different VM”? |
In the long run, we might want to switch to Wayland. |
Ah, so you mean that small rectangle with mic icon? I think that's actually a feature, to have it clearly visible, always, that some website is listening.
Technically it would be tricky (normally window manager draws those, but override redirect windows are excluded form window manager handling), but also it wouldn't help with the main issue - that those windows are not included in normal focus switching, cannot be moved etc - exactly because window manager doesn't handle them. Please read the comment I linked for details.
Again - focus handling is weird in relation to those windows. IIUC it isn't possible to switch focus to such window (window manager won't let you do that). Preventing gaining a focus may prevent some malicious usage of such windows, but also will break many applications (at least network manager applet, which formally doesn't have focus).
Yes, it may eliminate this problem. And introduce a new set of problems ;) Actually, it would be interesting to see how override-redirect windows are handled by xwayland. |
The warning message might need some improvement to be understandable by end users: https://qubes-os.discourse.group/t/warning-message-from-qubes-rpc/500 |
After reading the user report linked by @andrewdavidwong , I realized that the warning message is too technical, and potentially not helpful. Furthermore, as mentioned by @juodumas in this comment, it looks like LibreOffice on Debian 10-based AppVMs triggers the same warning. The fact that this warning is triggered by a commonly used application may cause users to learn to ignore this warning (after all, what can be done, aside from disabling the override redirect protection for the affected AppVMs?), reducing the warning's value. Perhaps we can remove the override-redirect protection-related warning message in question from the code altogether? If there is consensus on the removal of the warning message, I can prepare a pull request. |
If I understand correctly:
Maybe @ninavizz has an opinion? |
Or even worse - disable the protection based on instructions there to get rid of the notification, even if nothing is really broken. I think it's better to remove the warning notification (but still write it into the log). |
I definitely feel that warning is confusing. The pattern that's being described above is also very confusing, and unique to Qubes OS in a fashion that feels necessary; but could use some refinement. Will keep on my plate to look at in the future when we have the bandwidth to reconsider broader desktop experience things. |
It probably is, but I think it is reasonable to impose limits on such windows. For instance, they could be converted to normal titlebar windows, and limited in number per VM. I would also be happy to just ban them from the task bar; in the case of QubesOS, it is are more annoying than it is beneficial. |
I would very much welcome a patch that do any of the above, and do not break legitimate applications. |
My current plan:
|
@DemiMarie Might you be open to do a synchronous screenshare/call this week to discuss? Honestly curious what this issue, #6347, and #6931 all speak to and what remediations may imply for users. |
Absolutely! |
Qubes OS version:
R4.0
Affected component(s):
Tested on an up-to-date debian-9 AppVM.
Steps to reproduce the behavior:
Expected behavior:
No window should be able to go fullscreen without user interaction (
/etc/qubes/guid.conf
does not containallow_fullscreen = true
). For example, pressing F11 in Firefox (which is a Firefox shortcut, not a window manager one) maximises the window, but does not let it actually go fullscreen.Actual behavior:
A fullscreen window opens. There is a 1px border visible that hints that something is wrong, but otherwise it can draw over the entire desktop, including the Dom0 menu at the top of the screen. It also manages to steal some keyboard shortcuts, including Ctrl+Shift+P, and partially steals Alt+Tab (the focus indeed goes from one window to another, but it seems that windows that belong to another VM cannot be brought forwards. It also manages to prevent input to other windows most of the time. Sometimes mouse input is possible in other windows (as can be observed if inactive windows are set to transparent in Dom0's compositor options), but after a few Alt+Tab it is impossible to click anywhere (the mouse cursor moves, but keyboard input and clicks do not work anymore).
General notes:
A malicious VM could exploit the same X11 calls to produce a somewhat credible fake desktop (which couldn't access other VM's data of course, but could still be dangerous for password input etc.).
Related issues:
The text was updated successfully, but these errors were encountered: