An Indian researcher discovered an important local privilege escalation vulnerability that poses a security threat to most Linux distros and BSD variants. Exploiting the bug in the X.Org server could allow an attacker to gain root access.
Vulnerability In X.Org Server Discovered
Researcher Narendra Shinde discovered a serious vulnerability affecting multiple BSD and Linux distributions. Reportedly, X-Org server has local privilege escalation flaw that allows an attacker to elevate privileges and gain root access.
Shinde has disclosed his findings in a separate report. As stated, the x-Org server has an “arbitrary file overwrite” vulnerability. It allows an attacker to create or amend files on the target system.
“X.org X Server application is vulnerable to privilege escalation issue. X.org X Server application allows lower privileged user to create or overwrite file anywhere on system, including files owned by privileged users (ex. /etc/shadow). The attacker needs to have active console session to exploit this issue.”
According to X.org’s security advisory, the vulnerability mainly exists due to incorrect handling and validation of argument for at least two command-line parameters: -modulepath, and –logfile.
“Incorrect command-line parameter validation in the Xorg X server can lead to privilege elevation and/or arbitrary files overwrite, when the X server is running with elevated privileges (ie when Xorg is installed with the setuid bit set and started by a non-root user).”
Although, the vulnerability won’t let an attacker gain access to the system, it certainly facilitates them to gain complete control if they already have a lower privileged account. The issue received CVE-2018-14665, and mainly affects X.Org X server 1.19.0 and later.
Another researcher Matthew Hickey of the Hacker House has also shared his POC in a tweet.
X.Org Patched The Bug
X.Org server is a core graphics and windowing technology that provides the base for GNOME and KDE desktop interface suites. It forms a major component of most Linux distros and BSD variants that offer a GUI interface.
X.Org explained:
“The -modulepath argument can be used to specify an insecure path to modules that are going to be loaded in the X server, allowing to execute unprivileged code in the privileged process. The -logfile argument can be used to overwrite arbitrary files in the file system, due to incorrect checks in the parsing of the option.”
After the discovery of the vulnerability, Shinde informed X.Org and Red Hat teams of the matter. Since then, both X.Org and Red Hat stepped up to patch the bug. After that, the researcher published a coordinated disclosure on October 25, 2018.
Users can find the patch for this vulnerability on the xserver repository. If the patch isn’t available, then X.Org suggests a workaround.
“If a patched version of the X server is not available, X.Org recommends to remove the setuid bit (ie chmod 755) of the installed Xorg binary. Note that this can cause issues if people are starting the X window system using the ‘startx’, ‘xinit’ commands or variations thereof.”
In addition, the affected distros including OpenBSD, Red Hat, Ubuntu, Debian, SUSE, CentOS, and Fedora have also published separate security advisories recommending the patches.