CVE-2024-21885: Xorg-x11-server: heap buffer overflow in xisenddevicehierarchyevent
A flaw was found in X.Org server. In the XISendDeviceHierarchyEvent function, it is possible to exceed the allocated array length when certain new device IDs are added to the xXIHierarchyInfo struct. This can trigger a heap buffer overflow condition, which may lead to an application crash or remote code execution in SSH X11 forwarding environments.
Other sources
Xorg-x11-server: heap buffer overflow in xisenddevicehierarchyevent
— Microsoft
ZDI-CAN-22744 - VULNERABILITY DETAILS Version tested:1.21.1.7 Installer file:- Platform tested:debian-live-12.2.0-amd64-xfce.iso
Analysis
The exploit doesn't work if the OS installed on vmware and default virtualbox it works on virtualbox with VBoxVGA graphic controller
XISendDeviceHierarchyEvent() function allocated the fixed length array for struct xXIHierarchyInfo. However, If a device with a given ID was removed and a new device with the same ID added the info structs might be written to the array of struct xXIHierarchyInfo twice and over the size limit. It leads to heap overflow and LPE for some distributions (xorg in debian xfce is run as root under specific display driver) and RCE for ssh x11 forwarding environment.
Reference: https://gitlab.freedesktop.org/xorg/xserver/-/blob/8cce7f5d64d4f1027801892631b65b2c859cc559/Xi/xichangehierarchy.c#L60
Upstream patches: https://gitlab.freedesktop.org/xorg/xserver/-/mergerequests/1245
— Red Hat
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2024-21885?
CVE-2024-21885 is classified as a high severity vulnerability due to the potential for a heap buffer overflow.
How do I fix CVE-2024-21885?
To remediate CVE-2024-21885, update the X.Org server to version 21.1.11 or the Xwayland to version 23.2.4, or apply the specified patches from your Linux distribution.
What impact does CVE-2024-21885 have on my system?
CVE-2024-21885 can lead to application crashes or arbitrary code execution due to a heap buffer overflow caused by adding certain new device IDs.
Which software versions are affected by CVE-2024-21885?
CVE-2024-21885 affects specific versions of the X.Org server and Xwayland, particularly those before the fixed versions of 21.1.11 and 23.2.4 respectively.
Is there a known exploit for CVE-2024-21885?
As of now, there are no publicly available exploits specifically targeting CVE-2024-21885, but the vulnerability itself poses significant risk.