CVE-2024-21885: Xorg-x11-server: heap buffer overflow in xisenddevicehierarchyevent

Published Jan 2, 2024
·
Updated

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

24 affected componentsFixes available
redhat/xorg-server<21.1.11
21.1.11
redhat/xwayland<23.2.4
23.2.4
All of the following
azurelinux/xorg-x11-server<1.20.10-10
1.20.10-10
Microsoft CBL-Mariner=2.0
debian/xorg-server<2:21.1.7-3+deb12u5
2:21.1.7-3+deb12u5
debian/xorg-server<2:21.1.11-1
2:21.1.11-1
debian/xorg-server<2:21.1.11-1
2:21.1.11-1
debian/xwayland*
debian/xwayland<2:23.2.4-1
2:23.2.4-1
debian/xwayland<2:23.2.4-1
2:23.2.4-1
debian/xorg-server
2:21.1.7-3+deb12u122:21.1.7-3+deb12u132:21.1.16-1.3+deb13u32:21.1.16-1.3+deb13u42:21.1.25-2
debian/xwayland<=2:22.1.9-1
2:24.1.6-12:24.1.14-1
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xorg-server<21.1.11-r0
21.1.11-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0
alpine/xwayland<23.2.4-r0
23.2.4-r0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/xorg-server to a version that resolves this vulnerability.

    Fixed in 2:1.20.11-1+deb11u13Fixed in 2:1.20.11-1+deb11u15Fixed in 2:21.1.7-3+deb12u9Fixed in 2:21.1.16-1
  2. Upgrade

    Upgrade debian/xwayland to a version that resolves this vulnerability.

    Fixed in 2:24.1.6-1
  3. Upgrade

    Upgrade redhat/xorg-server to a version that resolves this vulnerability.

    Fixed in 21.1.11
  4. Upgrade

    Upgrade redhat/xwayland to a version that resolves this vulnerability.

    Fixed in 23.2.4
  5. Upgrade

    Upgrade azurelinux/xorg-x11-server to a version that resolves this vulnerability.

    Fixed in 1.20.10-10
  6. Upgrade

    Upgrade X.Org server to a version that resolves this vulnerability.

    Patch 1245

Event History

Jan 2, 2024
Data Sourced
via Red Hat·10:06 PM
DescriptionSeverityAffected Software
Feb 28, 2024
CVE Published
via MITRE·12:11 PM
Data Sourced
via MITRE·12:11 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:15 PM
DescriptionSeverityWeakness
Data Sourced
via OSV·01:15 PM
DescriptionSeverityAffected Software
Jun 30, 2024
Data Sourced
via Microsoft·02:00 PM
DescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

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.

2

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.

3

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.

4

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.

5

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.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203