Bug 2213748 (CVE-2023-3138)

Summary: CVE-2023-3138 libX11: InitExt.c can overwrite unintended portions of the Display structure if the extension request leads to a buffer overflow
Product: [Other] Security Response Reporter: Marian Rehak <mrehak>
Component: vulnerabilityAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: ajax, ndegraef
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libX11 1.8.6 Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was found in libX11. The security flaw occurs because the functions in src/InitExt.c in libX11 do not check that the values provided for the Request, Event, or Error IDs are within the bounds of the arrays that those functions write to, using those IDs as array indexes. They trust that they were called with values provided by an Xserver adhering to the bounds specified in the X11 protocol, as all X servers provided by X.Org do. As the protocol only specifies a single byte for these values, an out-of-bounds value provided by a malicious server (or a malicious proxy-in-the-middle) can only overwrite other portions of the Display structure and not write outside the bounds of the Display structure itself, possibly causing the client to crash with this memory corruption.
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: 2213762, 2213763, 2215372    
Bug Blocks: 2213123    

Description Marian Rehak 2023-06-09 07:04:56 UTC
The functions in src/InitExt.c in libX11 prior to 1.8.6 do not check that the values provided for the Request, Event, or Error IDs are within the bounds of the arrays that those functions write to, using those IDs as array indexes.  Instead they trusted that they were called with values provided by an Xserver that was adhering to the bounds specified in the X11 protocol, as all X servers provided by X.Org do.

As the protocol only specifies a single byte for these values, an out-of-bounds value provided by a malicious server (or a malicious proxy-in-the-middle) can only overwrite other portions of the Display structure and not write outside the bounds of the Display structure itself.  Testing has found it is possible to at least cause the client to crash with this memory corruption.

This is fixed in:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/TBD
which is included in the libX11 1.8.6 release issued today.

X.Org thanks Gregory James Duck for reporting this issue to our security
team.

Comment 2 Guilherme de Almeida Suckevicz 2023-06-15 18:32:13 UTC
Created libX11 tracking bugs for this issue:

Affects: fedora-all [bug 2215372]

Comment 3 Niels De Graef 2023-06-19 15:38:15 UTC
(In reply to Marian Rehak from comment #0)
> This is fixed in:
> https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/TBD
> which is included in the libX11 1.8.6 release issued today.

Probably that link/commit should be

https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/304a654a0d57bf0f00d8998185f0360332cfa36c

Comment 5 errata-xmlrpc 2023-11-07 08:18:22 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2023:6497 https://access.redhat.com/errata/RHSA-2023:6497

Comment 6 errata-xmlrpc 2023-11-14 15:18:49 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2023:7029 https://access.redhat.com/errata/RHSA-2023:7029

Comment 9 errata-xmlrpc 2024-03-05 08:19:47 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9.2 Extended Update Support

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

Comment 10 errata-xmlrpc 2024-03-19 17:30:32 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8.8 Extended Update Support

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