Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 1637761 - (CVE-2018-14665) CVE-2018-14665 xorg-x11-server: Incorrect permission check in Xorg X server allows for privilege escalation [NEEDINFO]
CVE-2018-14665 xorg-x11-server: Incorrect permission check in Xorg X server a...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
high Severity high
: ---
: ---
Assigned To: Red Hat Product Security
impact=important,public=20181025:1400...
: Security
Depends On: 1639249 1643132 1639248 1643131
Blocks: 1637763
  Show dependency treegraph
 
Reported: 2018-10-09 22:20 EDT by Sam Fowler
Modified: 2018-11-13 16:05 EST (History)
23 users (show)

See Also:
Fixed In Version: xorg-x11-server 1.20.3
Doc Type: If docs needed, set a value
Doc Text:
An incorrect permission check for -modulepath and -logfile options when starting Xorg X server allows unprivileged users with the ability to log in to the system via physical console to escalate their privileges and run arbitrary code under root privileges.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-10-30 13:28:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
thoger: needinfo? (ajax)


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3410 None None None 2018-10-30 13:00 EDT

  None (edit)
Description Sam Fowler 2018-10-09 22:20:52 EDT
The X.org X11 server has a vulnerability that allows local users to escalate to
full root privileges. The /usr/bin/Xorg setuid binary shipped in the
xorg-x11-server-Xorg package allows for arbitrary file creation with certain
parameters, allowing attackers with low privilege access to overwrite system
files and subsequently execute arbitrary code.
Comment 1 Sam Fowler 2018-10-11 00:44:11 EDT
Acknowledgments:

Name: Narendra Shinde
Comment 9 Tomas Hoger 2018-10-14 11:40:08 EDT
This flaw was introduced in the upstream xserver version 1.19.0 via the following commit:

https://gitlab.freedesktop.org/xorg/xserver/commit/032b1d79b7

Prior to that commit, X server command line options -logfile and -modulepath could only be used when X server is started by the root user.  The above commit changed checking of these options to use the same code that was previously used for -config and -configdir options, which additionally allows arguments that are relative paths.  However, accepting relative paths for -logfile and -modulepath is not safe.

As 1.19.0 is the first affected version, Red Hat Enterprise Linux 7 is only affected as of the erratum RHBA-2017:1905, which was released as part of Red Hat Enterprise Linux 7.4, which rebased xorg-x11-server component from version 1.17.2 to version 1.19.3.  The versions of xorg-x11-server as shipped with Red Hat Enterprise Linux 7.3 and earlier are not affected.  Therefore, for Red Hat Enterprise Linux 7.4 and later, this issue can be mitigated by downgrading to version 1.17.2.

The versions of xorg-x11-server as shipped with Red Hat Enterprise Linux 6 and earlier were never updated to version 1.19.0 or later, and hence are not affected by this issue.

Note that the default PAM configuration for the xserver in Red Hat Enterprise Linux only allows users with physical access to the console to start Xorg server.  This restriction prevents exploitation of this flaw over remote connections, such as over SSH connection.
Comment 10 Narendra 2018-10-14 11:55:34 EDT
About, 

> Note that the default PAM configuration for the xserver in Red Hat
> Enterprise Linux only allows users with physical access to the console
> to start Xorg server.  This >restriction prevents exploitation of this
> flaw over remote connections, such as over SSH connection.

In my testing environment, if user is logged into console, s/he can exploit this issue remotely using SSH too. Could you please check ? 


[Dev@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
[Dev@localhost ~]$ 
[Dev@localhost ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.5 (Maipo)
[Dev@localhost ~]$ 
[Dev@localhost ~]$ 
[Dev@localhost ~]$ cd /etc
[Dev@localhost etc]$ 
[Dev@localhost etc]$ Xorg -logfile crafted :1

X.Org X Server 1.19.5
Release Date: 2017-10-12
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-696.18.7.el6.x86_64 
Current Operating System: Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-862.el7.x86_64 root=/dev/mapper/rhel-root ro crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8
Build Date: 13 February 2018  02:39:52PM
Build ID: xorg-x11-server 1.19.5-5.el7 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "crafted", Time: Sun Oct 14 21:22:11 2018
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
^Cerror setting MTRR (base = 0x00000000e0000000, size = 0x01700000, type = 1) Invalid argument (22)
(II) Server terminated successfully (0). Closing log file.
[Dev@localhost etc]$ ^C
[Dev@localhost etc]$ ^C
[Dev@localhost etc]$ ls -la crafted 
-rw-r--r--. 1 root Dev 53902 Oct 14 21:22 crafted
[Dev@localhost etc]$ 
[Dev@localhost etc]$
Comment 11 Tomas Hoger 2018-10-14 17:08:46 EDT
(In reply to Narendra from comment #10)
> In my testing environment, if user is logged into console, s/he can exploit
> this issue remotely using SSH too. Could you please check ? 

Right, that's how pam_console works.  The point is that attacker needs an open console session to run Xorg, even though it may be associated with a different terminal.  If attacker does not have console access to the target system, this PAM configuration prevents them from running Xorg there.  Only having remote SSH access is not enough.
Comment 12 Narendra 2018-10-14 17:49:43 EDT
True. Thanks.
Comment 24 Adam Mariš 2018-10-25 10:34:21 EDT
External References:

https://lists.x.org/archives/xorg-announce/2018-October/002927.html
Comment 25 Adam Mariš 2018-10-25 10:35:48 EDT
Created xorg-x11-server tracking bugs for this issue:

Affects: fedora-all [bug 1643131]
Comment 27 Tomas Hoger 2018-10-26 02:55:53 EDT
Blog post from the original reporter:

https://www.securepatterns.com/2018/10/cve-2018-14665-xorg-x-server.html
Comment 30 Adam Mariš 2018-10-26 04:27:28 EDT
Statement:

This issue did not affect the versions of xorg-x11-server as shipped with Red Hat Enterprise Linux 5 and 6, as well as Red Hat Enterprise Linux 7 prior to 7.4, as they did not allow the use of vulnerable command line options when running with elevated privileges.

The default X server configuration in Red Hat Enterprise Linux only allows users logged in on the system's physical console to run Xorg X server. Therefore, users which only have remote access to the the system (for example using SSH) can not exploit this flaw.
Comment 31 errata-xmlrpc 2018-10-30 12:59:55 EDT
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2018:3410 https://access.redhat.com/errata/RHSA-2018:3410
Comment 33 Tomas Hoger 2018-11-13 16:05:57 EST
Another write up form the original reporter describing exploitation using the -modulepath option:

https://www.securepatterns.com/2018/10/cve-2018-14665-another-way-of.html

Note You need to log in before you can comment on or make changes to this bug.