Skip to content
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

Override redirect protection does not consider multiple windows #7085

Open
marmarek opened this issue Nov 24, 2021 · 11 comments
Open

Override redirect protection does not consider multiple windows #7085

marmarek opened this issue Nov 24, 2021 · 11 comments
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: gui-virtualization diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. security This issue pertains to the security of Qubes OS. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.

Comments

@marmarek
Copy link
Member

How to file a helpful issue

Qubes OS release

R4.0

Brief summary

Override-redirect protection protects against a single window covering the whole screen. Specifically, if a window with override-redirect flag covers more than 90% of the screen area, it's override-redirect flag is cleared. But, it does not consider multiple windows together covering the whole screen.

Steps to reproduce

  1. Have multi-monitor system.
  2. Install xfce4-screensaver in a VM.
  3. Start it.

Expected behavior

Screen locking windows are converted to normal windows.

Actual behavior

Each monitor is covered with a separate, override-redirect window. Each use about 50% of the total screen area (depending on monitor resolutions), but together they cover it all.

In that case, one can still use qvm-xkill (bound to Ctrl+Alt+Esc by default), or switch to tty2 and kill the VM (or the process) from there.

Proposed solution

Consider not only a single window, but all the windows with override-redirect flag set. Sum their areas and compare that against screen area. For simplicity, do not consider their positions (this may lead to false-positives, when there are several small windows in the same place, but those should be rather unlikely).

I'm not sure what should be the action if they cross 90% threshold. Some ideas:

  • unset the flag on the window causing the threshold to be crossed
  • unset the flag on the biggest one (and continue until it's below the threshold)
  • unset the flag on all of them

I'm leaning towards the last option, but requires checking what will happen in practice if a menu or a tooltip get the flag cleared (as a side effect).

@marmarek marmarek added T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. labels Nov 24, 2021
@marmarek marmarek added this to the Release 4.0 updates milestone Nov 24, 2021
@andrewdavidwong andrewdavidwong added C: gui-virtualization diagnosed Technical diagnosis has been performed (see issue comments). security This issue pertains to the security of Qubes OS. labels Nov 25, 2021
@iamahuman
Copy link

iamahuman commented Nov 28, 2021

Which measure do you think should be better for the purpose? The area of union of rectangles, or the covering bounding box?

@marmarek
Copy link
Member Author

I'd say the former. The later could have frequent false-positives (like, four tiny windows in screen corners).

@iamahuman
Copy link

iamahuman commented Nov 28, 2021

I just came up with some more scenarios override-redirect windows could be abused:

  • The malicious VM opens up a bunch of small windows everywhere, covering up 90% - ε of the area. The only remaining controllable area becomes the tiny gaps between the windows.
  • The malicious VM continuously changes the position of its windows, effectively obscuring from the user every area occupied in a small time window.
  • The malicious VM spins up another Disposable VM, and they cooperate with each other to cover up the screen area.

Thus, in addition to union-of-rectangles, I suppose that the protection should:

  1. Measure the state of window placement over a time window, rather than sampling it at a particular moment.
    • The simplest solution would be calculating the union over [t - k, t). This however may result in false positives (esp. if the user switches between menus frequently). Perhaps we can minimize the false positive with some fine-tuned convolution kernel over the time domain.
  2. Detect whether there is at least one (or possibly more) continuous screen area (of some shape) not obscured by override-redirect windows.
  3. Combine the two detection methods above.

@marmarek
Copy link
Member Author

I don't want this check to be too complex, or too slow to compute... Maybe make the limit tighter (80%?) and/or add override-redirect windows number to the heuristic (10? 20?).
Note in R4.1 we have additional feature of enforcing (window manager defined) work area, which effectively means the panel cannot be obscured, regardless of number or size of the windows.

@DemiMarie
Copy link

I don't want this check to be too complex, or too slow to compute... Maybe make the limit tighter (80%?) and/or add override-redirect windows number to the heuristic (10? 20?).

Unless I am missing something (I probably am), 2 or 3 should be a reasonable limit.

@marmarek
Copy link
Member Author

Unless I am missing something (I probably am), 2 or 3 should be a reasonable limit.

No, that will trivially cause false-positives. Take 2-level menu, add some notification and boom.

@DemiMarie
Copy link

Unless I am missing something (I probably am), 2 or 3 should be a reasonable limit.

No, that will trivially cause false-positives. Take 2-level menu, add some notification and boom.

Whoops! Then indeed I was missing something.

@DemiMarie DemiMarie self-assigned this Mar 2, 2022
@andrewdavidwong andrewdavidwong added the eol-4.0 Closed because Qubes 4.0 has reached end-of-life (EOL) label Aug 5, 2023
@github-actions
Copy link

github-actions bot commented Aug 6, 2023

This issue is being closed because:

If anyone believes that this issue should be reopened and reassigned to an active milestone, please leave a brief comment.
(For example, if a bug still affects Qubes OS 4.1, then the comment "Affects 4.1" will suffice.)

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
@DemiMarie
Copy link

Still an issue in R4.1.

@DemiMarie DemiMarie reopened this Aug 6, 2023
@andrewdavidwong andrewdavidwong removed the eol-4.0 Closed because Qubes 4.0 has reached end-of-life (EOL) label Aug 6, 2023
@andrewdavidwong andrewdavidwong added the affects-4.1 This issue affects Qubes OS 4.1. label Aug 8, 2023
@andrewdavidwong andrewdavidwong removed this from the Release 4.1 updates milestone Aug 13, 2023
@DemiMarie DemiMarie removed their assignment Mar 6, 2024
@andrewdavidwong andrewdavidwong added the eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) label Dec 7, 2024

This comment was marked as outdated.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
@DemiMarie
Copy link

Still affects 4.2, or at least I am not aware of a change that fixed it.

@DemiMarie DemiMarie reopened this Dec 8, 2024
@andrewdavidwong andrewdavidwong added affects-4.2 This issue affects Qubes OS 4.2. and removed eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) labels Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. affects-4.2 This issue affects Qubes OS 4.2. C: gui-virtualization diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. security This issue pertains to the security of Qubes OS. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.
Projects
None yet
Development

No branches or pull requests

4 participants