Opened 7 months ago

Closed 7 months ago

#18670 closed enhancement (fixed)

libX11-1.8.7

Reported by: Xi Ruoyao Owned by: Douglas R. Reno
Priority: elevated Milestone: 12.1
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description (last modified by Xi Ruoyao)

New patch version with security fixes for CVE-2023-4378{5,6,7}.

Change History (5)

comment:1 by Xi Ruoyao, 7 months ago

Description: modified (diff)

comment:2 by Xi Ruoyao, 7 months ago

This release contains fixes for the issues reported in today's security advisory: https://lists.x.org/archives/xorg-announce/2023-October/003424.html along with:

  • Fail XOpenDisplay() if server-provided default visual is invalid (!233)
  • Bring XKB docs in line with actual implementation (!231, !228)
  • Xutil.h: declare XEmptyRegion() and XEqualRegion() as Bool (!225)
  • Assorted updates to en_US.UTF-8 compose keys (!213, !214, !215, !216, !217, !219, !220, !222, !223, !226, !227, !229)

comment:3 by Douglas R. Reno, 7 months ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned

comment:4 by Douglas R. Reno, 7 months ago

From the security advisory (I trimmed the libXpm part out of this posting, I'll put the other chunk in the libXpm ticket):

The first issue (CVE-2023-43785) can be triggered by connecting to an
X server that sends specially crafted replies to X11 protocol requests.

The other 4 issues can be triggered by opening specially crafted XPM format
image files via libXpm.  Two of the four issues have root causes in the
libX11 library and are fixed there, but patches have also been applied
to libXpm to avoid passing the invalid data to libX11 in the first place.

1) CVE-2023-43785 libX11: out-of-bounds memory access in _XkbReadKeySyms()

Introduced in: X11R6.1 [released March 1996]
Fixed in: libX11 1.8.7
Found by: Gregory James DUCK
Fixed by: Alan Coopersmith of Oracle Solaris Engineering

When libX11 is processing the reply from the X server to the XkbGetMap
request, if it detected the number of symbols in the new map was less
than the size of the buffer it had allocated, it always added room for
128 more symbols, instead of the actual size needed. While the
_XkbReadBufferCopyKeySyms() helper function returned an error if asked
to copy more keysyms into the buffer than there was space allocated for,
the caller never checked for an error and assumed the full set of keysyms
was copied into the buffer and could then try to read out of bounds when
accessing the buffer.  libX11 1.8.7 has been patched to both fix the size
allocated and check for error returns from _XkbReadBufferCopyKeySyms().

Fix:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/6858d468d9ca55fb4c5fd70b223dbc78a3358a7f

2) CVE-2023-43786 libX11: stack exhaustion from infinite recursion
   in PutSubImage()

Introduced in: X11R2 [released Feb. 1988]
Fixed in: libX11 1.8.7
Found by: Yair Mizrahi of the JFrog Vulnerability Research team
Fixed by: Alan Coopersmith of Oracle Solaris Engineering

When splitting a single line of pixels into chunks that fit in a single
request (not using the BIG-REQUESTS extension) to send to the X server,
the code did not take into account the number of bits per pixel, so would
just loop forever finding it needed to send more pixels than fit in the
given request size and not breaking them down into a small enough chunk to
fit.  An XPM file was provided that triggered this bug when loaded via
libXpm's XpmReadFileToPixmap() function, which in turn calls XPutImage()
and hit this bug.

Further hardening to prevent similar bugs was done in libX11 by making
XPutImage() clip images to the maximum X protocol pixmap size (limited
by the use of unsigned 16-bit integers for height & width) when writing
to X pixmaps, and by making XCreatePixmap() generate X errors if a
height or width was specified that did not fit into an unsigned 16-bit
integer.  In libXpm, hardening was done to return error codes for any
call that would have passed out-of-bounds width or height values to
XCreatePixmap().

Fix:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/204c3393c4c90a29ed6bef64e43849536e863a86

Hardening:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/73a37d5f2fcadd6540159b432a70d80f442ddf4a
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/b4031fc023816aca07fbd592ed97010b9b48784b
https://gitlab.freedesktop.org/xorg/lib/libxpm/-/commit/84fb14574c039f19ad7face87eb9acc31a50701c

3) CVE-2023-43787 libX11: integer overflow in XCreateImage() leading to
   a heap overflow

Introduced in: X11R2 [released Feb. 1988]
Fixed in: libX11 1.8.7
Found by: Yair Mizrahi of the JFrog Vulnerability Research team
Fixed by: Yair Mizrahi of the JFrog Vulnerability Research team

When creating an image, there was no validation that the multiplication
of the caller-provided width by the visual's bits_per_pixel did not
overflow and thus result in the allocation of a buffer too small to hold
the data that would be copied into it.  An XPM file was provided that
triggered this bug when loaded via libXpm's XpmReadFileToPixmap() function,
which in turn calls XCreateImage() and hit this bug.

Further hardening to prevent similar bugs was done in libXpm to return
error codes for any call to XCreateImage() that would have resulted in
this calculation overflowing.

Fix:
https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/7916869d16bdd115ac5be30a67c3749907aea6a0

Hardening:
https://gitlab.freedesktop.org/xorg/lib/libxpm/-/commit/91f887b41bf75648df725a4ed3be036da02e911e

comment:5 by Douglas R. Reno, 7 months ago

Resolution: fixed
Status: assignedclosed

Fixed at 39321593d209eb2975308446ce2b80c95e4f4a9c

SA-12.0-019 issued

Note: See TracTickets for help on using tickets.