Qubes OS 48 Published by

The following security updates is available for both Qubes OS 4.1 and 4.2:

QSB-104: GUI-related security bugs




QSB-104: GUI-related security bugs

We have published Qubes Security Bulletin (QSB) 104: GUI-related security bugs. The text of this QSB and its accompanying cryptographic signatures are reproduced below, followed by a general explanation of this announcement and authentication instructions.

Qubes Security Bulletin 104


---===[ Qubes Security Bulletin 104 ]===---

2024-07-30

GUI-related security bugs

User action
------------

Continue to update normally [1] in order to receive the security updates
described in the "Patching" section below. No other user action is
required in response to this QSB.

Summary
--------

This QSB concerns two separate GUI-related bugs with potential security
implications:

1. If the keyboard auto-repeat feature is enabled in a qube, as it is in
the default templates (due to an error), it can generate unexpected
key presses. In particular, if the user attempts to select either the
"Copy to other qube..." or "Move to other qube..." context menu
option on a file in the qube's graphical file manager using the Enter
key (rather than clicking on it with the mouse cursor), the keyboard
auto-repeat feature can cause the selected file to be opened in that
qube.

2. The Xfce taskbar in dom0 incorrectly handles application icons, which
can result in some application icons being the wrong color.

Impact
-------

The impact of the first bug depends on the user's habits. If the user
intends to copy a file to another qube before opening it, this bug could
result in that file being opened in the wrong qube, potentially
compromising it. For example, if the user receives a file via email,
saves it in the email qube, then attempts to copy it to another qube,
this bug could result in the file being opened in the email qube.

An attacker who manages to compromise a qube or an application running
inside of a qube could attempt to exploit the second bug in order to
make an application icon from that qube appear in dom0's Xfce taskbar
with a color different from that qube's true color label. For example,
an attacker who controls an application in a qube with the yellow color
label could cause that application's icon to have the color green in the
taskbar in an attempt to deceive or confuse the user. This bug affects
only application icon colors in dom0's Xfce taskbar. It does not affect
other window decorations (i.e., window borders, title bars, or icons in
title bars), nor does it affect icons that appear when switching between
windows with Alt + Tab.

Affected systems
-----------------

The first bug affects both Qubes OS 4.1 and 4.2. The only qubes that are
affected are those in which some program enables the keyboard
auto-repeat feature. The default templates automatically start the
program xfsettingsd, which in turn enables the keyboard auto-repeat
feature. Templates that do not have such a program installed (such as
minimal templates, by default) are not affected.

The second bug affects only Qubes OS 4.2 when using the Xfce desktop
environment, which is the default desktop environment.

Discussion
-----------

The first bug can occur if, and only if, the keyboard auto-repeat
feature is enabled in a qube. (When gui-agent starts, it disables
auto-repeat, but other programs, such as xfsettings in the default
templates, can re-enable it.) By design, qubes do not "see" all keyboard
events. Instead, each qube sees only the keyboard events that are sent
when a window belonging to that qube is in focus. Therefore, if all of a
qube's windows lose focus while a key is being pressed, it may appear to
the qube that the key was pressed for much longer than it actually was.
In particular, the qube may "believe" that the key is being pressed
until a window belonging to that qube regains focus and the key is
released.

Normally, the auto-repeat feature starts generating repeated key press
events after the initial auto-repeat delay has passed. While none of the
qube's windows are in focus, such events are ignored. However, if one of
the qube's windows regains focus while a key is in the pressed state,
the auto-repeat feature in that qube will continue generating repeated
key press events without waiting for the initial auto-repeat delay,
since from its point of view the key was being pressed the whole time.

In this particular case, when the user selects either the "Copy to other
qube..." or "Move to other qube..." option, focus switches to the qrexec
prompt in dom0, and the Enter key may appear to the qube to be pressed
the whole time while the user interacts with the qrexec prompt. When the
dom0 prompt window closes, focus returns to the qube's file manager
window. At this point, the qube believes that the Enter key has been
pressed for a long time, so the auto-repeat feature generates repeated
Enter key press events, which in turn cause the file manager to open the
file normally.

What ought to happen instead is that only dom0 should generate key
repeat events, because only dom0 knows how long a key has actually been
pressed. Meanwhile, the qube should see just one key press event and
(possibly much later) one key release event, and this is exactly what
happens when the auto-repeat feature is disabled in the qube. The qube
would still perceive a long key press while none of its windows have
focus. However, when one of the qube's windows regains focus, there
would not be any repeated key press events, and the qube would get the
current key state. (Note: One might consider sending a synthetic "key
release" event for any key that is still being pressed when an
application loses focus, but that would cause extra key presses to be
delivered when the application regains focus.)

The second bug is caused by the libwnck3 library (which is used by
Xfce's "Window Buttons" widget) interpreting icons incorrectly. Each
window icon is stored in a `_NET_WM_ICON` window property in an ARGB
format. The upstream version of the library correctly converts this ARGB
format into RGBA, then loads it into a `GdkPixbuf` object, which is
later used by the taskbar. However, the Fedora package has extra patches
that add support for HiDPI scaling, which changes `GdkPixbuf` to
`cairo_surface_t`. The latter has native support for the
`CAIRO_FORMAT_ARGB32` format, so the manual conversion was removed.

The problem is that `ARGB` and `CAIRO_FORMAT_ARGB32` have subtle
differences related to transparency. The latter assumes that color
channels are pre-multiplied by the alpha channel, [3] but this isn't the
case in `ARGB`. An attacker could attempt to exploit this vulnerability
in order to manipulate color channels after the icon has been colored in
accordance with the qube's color label, completely changing the icon's
color in some cases.

Specifically, by adjusting the alpha channel, it may be possible to wrap
high color values into low ones. For example, a pixel with the values
R=255, G=250, B=0, and A=254 should appear as yellow. However, due to
the pre-multiplied format, the alpha channel determines the valid range
for color channels. In this case, setting A=254 results in a valid range
of 0-254 for the R, G, and B color channels. Since R=255 is outside of
this range, the red channel would wrap to zero, resulting in a green
pixel. This bug has been present in Fedora's libwnck3 package since
Fedora 34. [4]

Patching
---------

The following packages contain security updates that address the
vulnerabilities described in this bulletin:

For Qubes 4.1, in templates:
- qubes-gui-agent version 4.1.34

For Qubes 4.2, in dom0 and templates:
- qubes-gui-agent version 4.2.17 (all templates)
- libwnck3 version 43.0-9 (Fedora templates and dom0)

These packages will migrate from the security-testing repository to the
current (stable) repository over the next two weeks after being tested
by the community. [2] Once available, the packages are to be installed
via the Qubes Update tool or its command-line equivalents. [1]

User session and all qubes must be restarted afterward in order for
the updates to take effect.

Credits
--------

The first bug was reported by Maurice Kayser.

The second bug was reported by Kamil Aronowski.

References
-----------

[1] https://www.qubes-os.org/doc/how-to-update/
[2] https://www.qubes-os.org/doc/testing/
[3] https://www.cairographics.org/manual/cairo-Image-Surfaces.html
[4] https://src.fedoraproject.org/rpms/libwnck3/c/96db18a8fe30eafb7bd3da04d18901723482f97b?branch=f34

The Qubes Security Team
https://www.qubes-os.org/security/



Source: qsb-104-2024.txt

Marek Marczykowski-Górecki’s PGP signature