Jose Exposito Quintana
2024-Jan-16 14:24 UTC
X.Org Security Advisory: Issues in X.Org X server prior to 21.1.11 and Xwayland prior to 23.2.4
X.Org Security Advisory: January 16, 2024 Issues in X.Org X server prior to 21.1.11 and Xwayland prior to 23.2.4 ======================================================================= Multiple issues have been found in the X server and Xwayland implementations published by X.Org for which we are releasing security fixes for in xorg-server-21.1.11 and xwayland-23.2.4. 1) CVE-2023-6816 can be triggered by passing an invalid array index to DeviceFocusEvent or ProcXIQueryPointer. 2) CVE-2024-0229 can be triggered if a device has both a button and a key class and zero buttons. 3) CVE-2024-21885 can be triggered if a device with a given ID was removed and a new device with the same ID added both in the same operation. 4) CVE-2024-21886 can be triggered by disabling a master device with disabled slave devices. 5) CVE-2024-0409 can be triggered by enabling SELinux xserver_object_manager and running a client. 6) CVE-2024-0408 can be triggered by enabling SELinux xserver_object_manager and creating a GLX PBuffer. ------------------------------------------------------------------------ 1) CVE-2023-6816: Heap buffer overflow in DeviceFocusEvent and ProcXIQueryPointer Introduced in: xorg-server-1.13.0 (2012) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fix: https://gitlab.freedesktop.org/xorg/xserver/-/commit/9e2ecb2af8302dedc49cb6a63ebe063c58a9e7e3 Found by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Both DeviceFocusEvent and the XIQueryPointer reply contain a bit for each logical button currently down. Buttons can be arbitrarily mapped to any value up to 255 but the X.Org Server was only allocating space for the device's number of buttons, leading to a heap overflow if a bigger value was used. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. 2) CVE-2024-0229: Reattaching to different master device may lead to out-of-bounds memory access Introduced in: xorg-server-1.1.1 (2006) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fixes: - https://gitlab.freedesktop.org/xorg/xserver/-/commit/ece23be888a93b741aa1209d1dbf64636109d6a5 - https://gitlab.freedesktop.org/xorg/xserver/-/commit/219c54b8a3337456ce5270ded6a67bcde53553d5 - https://gitlab.freedesktop.org/xorg/xserver/-/commit/df3c65706eb169d5938df0052059f3e0d5981b74 Found by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative If a device has both a button class and a key class and numButtons is zero, we can get an out-of-bounds write due to event under-allocation in the DeliverStateNotifyEvent function. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. 3) CVE-2024-21885: Heap buffer overflow in XISendDeviceHierarchyEvent Introduced in: xorg-server-1.10.0 (2011) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fix: https://gitlab.freedesktop.org/xorg/xserver/-/commit/4a5e9b1895627d40d26045bd0b7ef3dce503cbd1 Found by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative The XISendDeviceHierarchyEvent() function allocates space to store up to MAXDEVICES (256) xXIHierarchyInfo structures in info. If a device with a given ID was removed and a new device with the same ID added both in the same operation, the single device ID will lead to two info structures being written to info. Since this case can occur for every device ID at once, a total of two times MAXDEVICES info structures might be written to the allocation, leading to a heap buffer overflow. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. 4) CVE-2024-21886: Heap buffer overflow in DisableDevice Introduced in: xorg-server-1.13.0 (2012) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fixes: - https://gitlab.freedesktop.org/xorg/xserver/-/commit/bc1fdbe46559dd947674375946bbef54dd0ce36b - https://gitlab.freedesktop.org/xorg/xserver/-/commit/26769aa71fcbe0a8403b7fb13b7c9010cc07c3a8 Found by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative The DisableDevice() function is called whenever an enabled device is disabled and it moves the device from the inputInfo.devices linked list to the inputInfo.off_devices linked list. However, its link/unlink operation has an issue during the recursive call to DisableDevice() due to the prev pointer pointing to a removed device. This issue leads to a length mismatch between the total number of devices and the number of device in the list, leading to a heap overflow and, possibly, to local privilege escalation. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. 5) CVE-2024-0409: SELinux context corruption Introduced in: xorg-server-1.16.0 (2014) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fix: https://gitlab.freedesktop.org/xorg/xserver/-/commit/2ef0f1116c65d5cb06d7b6d83f8a1aea702c94f7 Found by: Olivier Fourdan The Xserver uses the mechanism of "privates" to store additional data to its own objects, each private has an associate "type". Each private is allocated for the relevant size of memory that is declared at creation. The cursor structure in the Xserver goes as far as having two keys, one for the cursor itself and another one for the bits that make the cursor shape. XSELINUX also uses privates but it's a bit of a special case because it uses the same privates keys for all different objects. What happens here is that the cursor code in both Xephyr and Xwayland uses the wrong type of private at creation, using the cursor bits type with the cursor private and when initiating the cursor, the overwrites the XSELINUX context. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. 6) CVE-2024-0408: SELinux unlabeled GLX PBuffer Introduced in: xorg-server-1.10.0 (2011) Fixed in: xorg-server-21.1.11 and xwayland-23.2.4 Fix: https://gitlab.freedesktop.org/xorg/xserver/-/commit/e5e8586a12a3ec915673edffa10dc8fe5e15dac3 Found by: Olivier Fourdan and Donn Seeley The XSELINUX code in the Xserver labels the X resources based on a hook. What happens here is that the GLX PBuffer code does not call that XACE hook when creating the buffer, so it remains unlabeled, and when the client issues another request to access that resource (as here with a GetGeometry) or even when it creates another resource which needs to access that buffer (such as a GC), the XSELINUX code will try to use an object that was never labeled and crash because the SID is NULL. xorg-server-21.1.11 and xwayland-23.2.4 have been patched to fix this issue. ------------------------------------------------------------------------ X.Org thanks all of those who reported and fixed these issues, and those who helped with the review and release of this advisory and these fixes. -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.x.org/archives/xorg-announce/attachments/20240116/09a47cbd/attachment.htm>