Bug 2256540 (CVE-2024-21885, ZDI-CAN-22744)

Summary: CVE-2024-21885 xorg-x11-server: heap buffer overflow in XISendDeviceHierarchyEvent
Product: [Other] Security Response Reporter: Robb Gatica <rgatica>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: xorg-server-21.1.11, xwayland-23.2.4 Doc Type: If docs needed, set a value
Doc Text:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2258932, 2258933    
Bug Blocks: 2256538    

Description Robb Gatica 2024-01-02 22:06:53 UTC
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

Comment 7 Sandipan Roy 2024-01-18 04:25:00 UTC
Created tigervnc tracking bugs for this issue:

Affects: fedora-all [bug 2258933]


Created xorg-x11-server tracking bugs for this issue:

Affects: fedora-all [bug 2258932]

Comment 8 errata-xmlrpc 2024-01-22 13:43:28 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2024:0320 https://access.redhat.com/errata/RHSA-2024:0320

Comment 9 errata-xmlrpc 2024-01-30 10:56:22 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:0557 https://access.redhat.com/errata/RHSA-2024:0557

Comment 10 errata-xmlrpc 2024-01-30 10:59:54 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Support
  Red Hat Enterprise Linux 8.4 Update Services for SAP Solutions
  Red Hat Enterprise Linux 8.4 Telecommunications Update Service

Via RHSA-2024:0558 https://access.redhat.com/errata/RHSA-2024:0558

Comment 11 errata-xmlrpc 2024-01-30 14:09:58 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.8 Extended Update Support

Via RHSA-2024:0597 https://access.redhat.com/errata/RHSA-2024:0597

Comment 12 errata-xmlrpc 2024-01-30 14:53:39 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2024:0607 https://access.redhat.com/errata/RHSA-2024:0607

Comment 13 errata-xmlrpc 2024-01-30 15:21:21 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.0 Extended Update Support

Via RHSA-2024:0614 https://access.redhat.com/errata/RHSA-2024:0614

Comment 14 errata-xmlrpc 2024-01-30 16:07:38 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.6 Extended Update Support

Via RHSA-2024:0621 https://access.redhat.com/errata/RHSA-2024:0621

Comment 15 errata-xmlrpc 2024-01-31 07:07:34 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.2 Advanced Update Support
  Red Hat Enterprise Linux 8.2 Update Services for SAP Solutions
  Red Hat Enterprise Linux 8.2 Telecommunications Update Service

Via RHSA-2024:0617 https://access.redhat.com/errata/RHSA-2024:0617

Comment 16 errata-xmlrpc 2024-01-31 08:31:17 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.2 Extended Update Support

Via RHSA-2024:0626 https://access.redhat.com/errata/RHSA-2024:0626

Comment 17 errata-xmlrpc 2024-01-31 08:43:40 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2024:0629 https://access.redhat.com/errata/RHSA-2024:0629

Comment 19 errata-xmlrpc 2024-04-30 09:43:16 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:2170 https://access.redhat.com/errata/RHSA-2024:2170

Comment 20 errata-xmlrpc 2024-04-30 09:43:25 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:2169 https://access.redhat.com/errata/RHSA-2024:2169