The officially official Devuan Forum!

You are not logged in.

#1 2023-10-03 18:32:05

Altoid
Member
Registered: 2017-05-07
Posts: 1,434  

X.Org Security Advisory: Issues in libX11 prior to 1.8.7 & libXpm

Hello:

Just got this in my inbox.

Good to see that things 'X11' are rolling along steadily.

Best,

A.

***********************************************************************************

X.Org Security Advisory:  October 3, 2023

Issues in libX11 prior to 1.8.7 & libXpm prior to 3.5.17
========================================================

Multiple issues have been found in the libX11 & libXpm libraries published
by X.Org for which we are releasing security fixes in libX11 1.8.7 &
libXpm 3.5.17.

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 … 78a3358a7f

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 … 536e863a86

Hardening:
https://gitlab.freedesktop.org/xorg/lib … 0f442ddf4a
https://gitlab.freedesktop.org/xorg/lib … 0b9b48784b
https://gitlab.freedesktop.org/xorg/lib … c31a50701c

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 … 9907aea6a0

Hardening:
https://gitlab.freedesktop.org/xorg/lib … 6da02e911e

4) CVE-2023-43788 libXpm: out of bounds read in XpmCreateXpmImageFromBuffer()

Introduced in: unknown - prior to xpm-3.4k [released 1998]
Fixed in: libXpm 3.5.17
Found by: Alan Coopersmith of Oracle Solaris Engineering
Fixed by: Alan Coopersmith of Oracle Solaris Engineering

When the test case for CVE-2022-46285 (fixed in libXpm 3.5.15) was run
with the Address Sanitizer enabled, it found an out-of-bounds read in
ParseComment() when reading from a memory buffer instead of a file, as
it continued to look for the closing comment marker past the end of the
buffer.

Fix:
https://gitlab.freedesktop.org/xorg/lib … f139ed67e0

5) CVE-2023-43789 libXpm: out of bounds read on XPM with corrupted colormap

Introduced in: unknown - prior to xpm-3.4k [released 1998]
Fixed in: libXpm 3.5.17
Found by: Alan Coopersmith of Oracle Solaris Engineering
Fixed by: Alan Coopersmith of Oracle Solaris Engineering

Fuzzing with clang's -fsanitize/libfuzzer generated an XPM file with a
corrupted colormap section which caused libXpm to read out of bounds.

Fix:
https://gitlab.freedesktop.org/xorg/lib … bc3fcd8f51

----------------------------------------------------------------------------

X.Org thanks all of those who reported and fixed these issues, and those
who helped with the review and release of this advisory and these fixes.

The X.Org security team would like to take this opportunity to remind X client
authors that current best practices suggest separating code that requires
privileges from the GUI, to reduce the risk of issues like CVE-2023-43785.

--
     -Alan Coopersmith-              alan.coopersmith@oracle.com
       X.Org Security Response Team - xorg-security@lists.x.org

--
        -Alan Coopersmith-                 alan.coopersmith@oracle.com
         Oracle Solaris Engineering - https://blogs.oracle.com/solaris

Offline

Board footer