Advisory-2016-10-04

X.Org security advisory: October 4, 2016

Protocol handling issues in X Window System client libraries

Description

Tobias Stoeckmann from the OpenBSD project has discovered a number of issues in the way various X client libraries handle the responses they receive from servers, and has worked with X.Org's security team to analyze, confirm, and fix these issues. These issue come in addition to the ones discovered by Ilja van Sprundel in 2013.

Most of these issues stem from the client libraries trusting the server to send correct protocol data, and not verifying that the values will not overflow or cause other damage. Most of the time X clients & servers are run by the same user, with the server more privileged than the clients, so this is not a problem, but there are scenarios in which a privileged client can be connected to an unprivileged server, for instance, connecting a setuid X client (such as a screen lock program) to a virtual X server (such as Xvfb or Xephyr) which the user has modified to return invalid data, potentially allowing the user to escalate their privileges.

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 attack surface of issues like this.

Affected libraries and CVE Ids

Fixes

Fixes are available in the following git commits.

8ea762f Validation of server responses in XGetImage()

8c29f16 The validation of server responses avoids out of boundary accesses.

61c1039 Integer overflow on illegal server response

19a9cd6 Properly validate server responses.

a0df3e1 Avoid out of boundary accesses on illegal responses

9362c7d Validate lengths while parsing server data.

8fad00b Avoid OOB write in XRenderQueryFilters

9556ad6 Out of boundary access and endless loop in libXtst

d9da58 Protocol handling issues in libXv

2cd95e7 Avoid buffer underflow on empty strings.

They are also available in these modules releases from X.Org:

Thanks

X.Org thanks Tobias Stoeckmann for reporting these issues to our security team and assisting them in understanding them and evaluating our fixes.