Bug 592 - standard startx script allows any user to capture X events (and keystroke) from other users' windows
standard startx script allows any user to capture X events (and keystroke) fr...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: XFree86 (Show other bugs)
5.2
All Linux
high Severity medium
: ---
: ---
Assigned To: Preston Brown
: Security
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1998-12-26 06:08 EST by borgia
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-01-18 17:20:47 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description borgia 1998-12-26 06:08:13 EST
Let's suppose I write a transparent X program (or go to
rootshell and get it, it is already there) and that I run it
on a workstation occupied by another user: the program sees
everything he does under X and logs every keystroke on a
file in my home dir.

Things like ssh are pretty useless in this situation... the
solution is to prevent other users from starting X apps on a
server they didn't start and this can be done in two ways:

1) by using xdm, that by default has authentication enabled

2) by modifying startx this way:

-cut-cut-
--- startx	Thu Nov 26 11:05:11 1998
+++ /usr/X11R6/bin/startx	Thu Nov 26 10:55:37 1998
@@ -44,7 +44,7 @@
     serverargs=$sysserverrc
 fi
 fi
-
+display=:0
 whoseargs="client"
 while [ "x$1" != "x" ]; do
     case "$1" in
@@ -58,10 +58,18 @@
 		    clientargs="$clientargs $1"
 		else
 		    serverargs="$serverargs $1"
+		    case "$1" in
+			:[0-9]) display="$1" ;;
+		    esac
 		fi ;;
     esac
     shift
 done
+
+mcookie=`mcookie`
+serverargs="$serverargs -auth $HOME/.Xauthority"
+xauth add $display . $mcookie
+xauth add `hostname -f`$display . $mcookie

 xinit $clientargs -- $serverargs
-cut-cut-

This problem was also present in RH5.0 and 5.1
Comment 1 landrye 1999-01-15 17:04:59 EST
You might also consider using the mkxauth package
Comment 2 Preston Brown 1999-01-18 17:20:59 EST
A patch to use xauth in startx will be posted to the errata site.
However, 5.2 will not incorporate this patch into XFree in an security
update, because many people are not familiar with xauth but only xhost
(no matter how wrong this is) and there will be much complaining from
them if we change this. 6.0 will make the change.

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