Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: dall@hfrd.dsto.gov.au (Ian Dall)
Subject: Re: Urgent: a hole in X security - xwatchwin2
Date: Fri, 19 Mar 1993 03:42:26 GMT	[thread overview]
Message-ID: <1993Mar19.034226.6576@hfrd.dsto.gov.au> (raw)
In-Reply-To: C41K1D.IH8@news.cis.umn.edu


In article <C41K1D.IH8@news.cis.umn.edu>, rjg@umnstat.stat.umn.edu (Robert J. Granvin) writes:
> Would someone be willing to post a quick summary on the proper usage of
> xauth, MIT-MAGIC-COOKIE and what all those little nuances a person needs
> to know to enable this most basic of display security?
> 
> (i.e., talking about the problems are great, but a quick summary of
> procedures would help the more novice users get up and running quicker...)

OK. Here goes. No doubt someone will correct me if I get it wrong!

A MIT-MAGIC-COOKIE is a long (random) number. Essentially, the server
allows any client which knows that random number to connect.

All the rest is just the mechanism by which the cookies are generated
and made known to the clients and servers.

The cookie can be specified on the commandline when a server is
started.  It can also be set by the XDM protocol. Magic cookies are
normally stored in a users ~/.Xauthority file. There is only one
cookie for each server the user is authorised to connect to.

XDM normally generates a magic cookie, communciates it with the server
via the XDM protocol and makes the entry for a given display just
before starting a users xsession. Clients look in the .Xauthority file
to get the cookie for the display they are trying to connect to.

XDM is strongly recommended (by me) over dxprompter or whatever it is
called. XDM can both start local servers and manage remote (X terminal)
servers. Also, I strongly recommend R5 xdm over R4 xdm. The configuration
is cleaner and I had some problems with R4 xdm on ultrix (only for
local servers). The X distribution comes with quite good examples for
all the config files needed for XDM. I've no idea whether the DEC unsupported
subsets MIT X has these sample config files. Certainly it is still back
at release 5.

If you don't use XDM, you need to a) generate a magic cookie, it is
just a random number of the right number of digits, b) start the server
with that magic cookie as an argument and c) enter the cookie into
.Xauthority using xauth.

Xauth can also be used to extract entries. With xauth plus a little fiddling
with rsh, you can, extract an entry from you local .Xauthority, enter
it into a remote .Xauthority (anywhere where you have permission to
write to .Xauthority) and then start clients on a remote machine. For
example, here is my xrsh script. It will normally allow you
to just do "xrsh host xterm" for example. Beware that if you use a shell
which doesn't have a built in echo, this script might momentarilly allow
your cookie to be seen with ps.


 #!/usr/bin/bash

 FROM=$HOME/.Xauthority
 XEXTRACT="xauth -f $FROM nextract - $DISPLAY"
 XMERGE="xauth nmerge -"
 XBIN=/usr/local/bin/X11:/usr/bin/X11

 AUTHKEY=`$XEXTRACT`

 SETENV="\
 DISPLAY=$DISPLAY; export DISPLAY;
 if [ -r .Xclientenv ]; then
   . .Xclientenv
 else
   PATH=$XBIN:"'$PATH'"; export PATH
 fi"

 cmd=xterm

 if [ $# -lt 1 ]; then
   echo $USAGE
   exit 1
 fi

 host=$1
 shift

 rsh $host exec sh <<-!END_REMOTE!
   $SETENV
   exec > .Xlog 2>&1
   (echo $AUTHKEY) | $XMERGE
   ${@:-$cmd}&
 !END_REMOTE!



I don't actually recall why I have brackets around "echo $AUTHKEY".
Possibly I used to close the file descriptors (instead of re-directing
them) and bash complained about trying to redirect a closed file
descriptor.
-- 
Ian Dall          I'm not into isms, but hedonism is the most
                  harmless I can think of. -- Phillip Adams

internet: dall@hfrd.dsto.gov.au


  reply	other threads:[~1993-03-19  3:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1993Mar15.071215.5122@tigger.jvnc.net>
1993-03-15 14:30 ` Urgent: a hole in X security - xwatchwin2 David O'Byrne
1993-03-15 16:59   ` Andre Beck
1993-03-15 17:50     ` Bob Heiney
     [not found]       ` <1o2jfe$1t7@irz401.inf.tu-dresden.de>
1993-03-15 19:58         ` Bob Heiney
     [not found]       ` <1o2p4t$20t@irz401.inf.tu-dresden.de>
1993-03-16 18:53         ` Bob Heiney
1993-03-15 19:56   ` Jack A. Zucker
     [not found]   ` <1993Mar16.230422.14356@grebyn.com>
1993-03-17  5:43     ` Jason Haar
1993-03-18 20:01       ` Jason Haar
1993-03-20 19:08         ` Bob Longo
1993-03-21 10:11           ` Klaus Steinberger
     [not found]   ` <CONS.93Mar17101003@mercury.cern.ch>
1993-03-17 16:19     ` Robert J. Granvin
1993-03-19  3:42       ` Ian Dall [this message]
1993-03-19  5:34         ` George Michaelson
1993-03-19 12:05           ` Andre Beck
1993-03-19 14:22         ` Marcus J Ranum
1993-03-21  4:55           ` Richard Todd
1993-03-22  7:33           ` Ian Dall
     [not found]       ` <1oq61sINNgp5@shelley.u.washington.edu>
1993-03-24 19:51         ` Robert J. Granvin
1993-03-19 22:25     ` Marc Fraioli
1993-03-22 14:07       ` Andre Beck
1993-03-22 21:27         ` Jason Haar
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox