Opened 3 years ago

Closed 3 years ago

#11046 closed enhancement (fixed)

libX11-1.6.6

Reported by: Douglas R. Reno Owned by: Bruce Dubbs
Priority: high Milestone: 8.3
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

New point version released as a result of the X.org Security Advisory of this morning.

X.Org security advisory: August 21, 2018

Multiple issues in libX11
=========================

The functions XGetFontPath, XListExtensions and XListFonts from libX11
are vulnerable to three different issues:

Off-by-one writes (CVE-2018-14599).
-----------------------------------

The functions XGetFontPath, XListExtensions, and XListFonts are
vulnerable to an off-by-one override on malicious server responses.

The server replies consist of chunks consisting of a length byte
followed by actual string, which is not NUL-terminated.

While parsing the response, the length byte is overridden with '\0',
thus the memory area can be used as storage of C strings later on. To
be able to NUL-terminate the last string, the buffer is reserved with
an additional byte of space.

For a boundary check, the variable chend (end of ch) was introduced,
pointing at the end of the buffer which ch initially points to.
Unfortunately there is a difference in handling "the end of ch".

While chend points at the first byte that must not be written to,
the for-loop uses chend as the last byte that can be written to.

Therefore, an off-by-one can occur.


Out of boundary write (CVE-2018-14600).
---------------------------------------

The length value is interpreted as signed char on many systems
(depending on default signedness of char), which can lead to an out of
boundary write up to 128 bytes in front of the allocated storage, but
limited to NUL byte(s).

Casting the length value to unsigned char fixes the problem and allows
string values with up to 255 characters.

Crash on invalid reply (CVE-2018-14598).
----------------------------------------

If the server sends a reply in which even the first string would
overflow the transmitted bytes, list[0] (or flist[0]) will be set to
NULL and a count of 0 is returned.

If the resulting list is freed with XFreeExtensionList or
XFreeFontPath later on, the first Xfree call:

    Xfree (list[0]-1)
 turns into
    Xfree (NULL-1)

which will most likely trigger a segmentation fault.

Patches
=======

Patches for these issues have been commited to the libX11 git repository.
libX11 1.6.6 will be released shortly and will include those patches.

https://gitlab.freedesktop.org/xorg/lib/libx11

b469da1430cdcee06e31c6251b83aede072a1ff0  CVE-2018-14599
dbf72805fd9d7b1846fe9a11b46f3994bfc27fea  CVE-2018-14600
e83722768fd5c467ef61fa159e8c6278770b45c2  CVE-2018-14598

Thanks
======

X.Org thanks Tobias Stoeckmann for reporting these issues to our
security team and assisting them in understanding them and evaluating
our fixes.
Alan Coopersmith (6):
      Make Xkb{Get,Set}NamedIndicator spec & manpages match code
      Clarify state parameter to XkbSetNamedDeviceIndicator
      Improve table formatting in XkbChangeControls & XkbKeyNumGroups man pages
      If XGetImage fails to create image, don't dereference it to bounds check
      Use size_t for buffer sizes in SetHints.c
      Change fall through comment in lcDB.c to match gcc's requirements

Arthur Huillet (1):
      _XDefaultError: set XlibDisplayIOError flag before calling exit

Bhavi Dhingra (1):
      Fix possible memory leak in cmsProp.c:140

Martin Natano (1):
      Don't rebuild ks_tables.h if nothing changed.

Matthieu Herrb (2):
      Remove statement with no effect.
      libX11 1.6.6

Michal Srb (1):
      Use flexible array member instead of fake size.

Ryan C. Gordon (1):
      Valgrind fix for XStoreColor and XStoreColors.

Samuel Thibault (1):
      XkbOpenDisplay.3: fix typo

Tobias Stoeckmann (4):
      Validation of server response in XListHosts.
      Fixed off-by-one writes (CVE-2018-14599).
      Fixed out of boundary write (CVE-2018-14600).
      Fixed crash on invalid reply (CVE-2018-14598).

walter harms (13):
      fix shadow warning
      _XIOError(dpy); will never return so remore dead
      remove argument check for free() adjust one inden
      fix shadow char_size
      fix more shadow warning
      no need to check argument for _XkbFree()
      remove stray extern
      no need to check args for Xfree()
      fix memleak in error path
      fix memleak in error path
      no need to check XFree arguments
      mark _XDefaultIOError as no_return
      Fixes: warning: variable 'req' set but not,used

wharms (3):
      add _X_UNUSED to avoid unused variable warnings
      remove empty line
      silence gcc warning assignment discards 'const' qualifier from pointer target type

Change History (3)

comment:1 by Douglas R. Reno, 3 years ago

If this needs to be done for 8.3, go ahead and change the milestone.

comment:2 by Bruce Dubbs, 3 years ago

Milestone: 8.48.3
Owner: changed from blfs-book to Bruce Dubbs
Status: newassigned

I'll do it.

comment:3 by Bruce Dubbs, 3 years ago

Resolution: fixed
Status: assignedclosed

Fixed at revision 20359.

Note: See TracTickets for help on using tickets.