4a08e23
From 8a59e3b7dbb30532a7c3769c555e00d7c4301170 Mon Sep 17 00:00:00 2001
4a08e23
From: Matthieu Herrb <matthieu@herrb.eu>
4a08e23
Date: Tue, 23 Oct 2018 21:29:08 +0200
4a08e23
Subject: [PATCH xserver] Disable -logfile and -modulepath when running with
4a08e23
 elevated privileges
4a08e23
4a08e23
Could cause privilege elevation and/or arbitrary files overwrite, when
4a08e23
the X server is running with elevated privileges (ie when Xorg is
4a08e23
installed with the setuid bit set and started by a non-root user).
4a08e23
4a08e23
CVE-2018-14665
4a08e23
4a08e23
Issue reported by Narendra Shinde and Red Hat.
4a08e23
4a08e23
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
4a08e23
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
4a08e23
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
4a08e23
Reviewed-by: Adam Jackson <ajax@redhat.com>
4a08e23
(cherry picked from commit 50c0cf885a6e91c0ea71fb49fa8f1b7c86fe330e)
4a08e23
---
4a08e23
 hw/xfree86/common/xf86Init.c | 8 ++++++--
4a08e23
 1 file changed, 6 insertions(+), 2 deletions(-)
4a08e23
4a08e23
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
4a08e23
index 3c5cc7097c..cabf8716b6 100644
4a08e23
--- a/hw/xfree86/common/xf86Init.c
4a08e23
+++ b/hw/xfree86/common/xf86Init.c
4a08e23
@@ -1027,14 +1027,18 @@ ddxProcessArgument(int argc, char **argv, int i)
4a08e23
     /* First the options that are not allowed with elevated privileges */
4a08e23
     if (!strcmp(argv[i], "-modulepath")) {
4a08e23
         CHECK_FOR_REQUIRED_ARGUMENT();
4a08e23
-        xf86CheckPrivs(argv[i], argv[i + 1]);
4a08e23
+        if (xf86PrivsElevated())
4a08e23
+              FatalError("\nInvalid argument -modulepath "
4a08e23
+                "with elevated privileges\n");
4a08e23
         xf86ModulePath = argv[i + 1];
4a08e23
         xf86ModPathFrom = X_CMDLINE;
4a08e23
         return 2;
4a08e23
     }
4a08e23
     if (!strcmp(argv[i], "-logfile")) {
4a08e23
         CHECK_FOR_REQUIRED_ARGUMENT();
4a08e23
-        xf86CheckPrivs(argv[i], argv[i + 1]);
4a08e23
+        if (xf86PrivsElevated())
4a08e23
+              FatalError("\nInvalid argument -logfile "
4a08e23
+                "with elevated privileges\n");
4a08e23
         xf86LogFile = argv[i + 1];
4a08e23
         xf86LogFileFrom = X_CMDLINE;
4a08e23
         return 2;
4a08e23
-- 
4a08e23
2.19.1
4a08e23