From: Nikita Schmidt <cetus@snowball.ucd.ie>
Subject: Re: Floppy, finger, date
Date: Tue, 25 Mar 1997 18:34:02 +0000 [thread overview]
Message-ID: <d75e671d50f81a4b8ae54c86b5ee7dbc.axp-list@archive.invalid> (raw)
In-Reply-To: <Pine.OSF.3.95.970325154328.16272A-100000@dipfis.ge.infn.it>
On Mar 25, Marco Corte wrote:
>
> Now three new problems:
>
...
>
> 3. How to tell my S3 server (3.1.2G) a "wrong" date so that I doesn't
> expire without changing the date on the whole system?
>
Unfortunately, I'm not really into RedHat distribution, so I cannot say
anything about first two problems. As for X server spoofing, my
approach is following:
1) build a shared library that defines `time' (see source code below);
2) make a setuid wrapper that starts X server with that library.
Since in pre-2.0 versions of glibc LD_PRELOAD fails on setuid
executables (more precisely, if real uid != effective uid) even when the
library name does not contain slashes (in ld-2.0.so setuid binaries can
be LD_PRELOADed with a library if its name is reasonably secure, i.e.
contains no slashes), a setuid wrapper is needed to set both real and
effective uids to 0 prior to running the X server. That's not good: for
example, X server remains rooty and cannot be killed from xinit when the
session is over (one has to press ctrl-alt-bs), and there may be
some security flaws with this approach, but I couldn't see any other
way (rebuilding ld-1.93.so is not worth it).
OK, let's take a look at the code.
---------------- libfaketime.c ----------------
#include <time.h>
time_t time (time_t *t)
{
if (t) *t = 844124400;
return 844124400;
}
-------------------- X.c ----------------------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
main (int argc, char *argv[])
{
setenv ("LD_PRELOAD", "/usr/local/lib/libfaketime.so", 1);
setuid (0);
execv ("/usr/X11R6/bin/Xserver", argv);
perror ("Cannot execute /usr/X11R6/bin/Xserver");
return 1;
}
------------------ Makefile -------------------
FLAGS = -O2 -pipe -fomit-frame-pointer -s
XBIN = /usr/X11R6/bin
all: X libfaketime.so
X: X.c
gcc $(FLAGS) -o $@ $<
libfaketime.so: libfaketime.c
gcc $(FLAGS) -shared -nostdlib -o $@ $<
install: all
cp libfaketime.so /usr/local/lib
mv $(XBIN)/X $(XBIN)/Xserver
cp X $(XBIN)/X
chown root.root $(XBIN)/X
chmod u+s $(XBIN)/X
-----------------------------------------------
Be careful with the install part. The idea is that the wrapper
described above gets installed in /usr/X11R6/bin and runs Xserver
(which can be just a link to the real binary; I did not want to put
any particular name in X.c). If you already have something called
/usr/X11R6/bin/Xserver, don't run make install, or you'll lose it!
Kit
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next parent reply other threads:[~1997-03-25 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.OSF.3.95.970325154328.16272A-100000@dipfis.ge.infn.it>
1997-03-25 18:34 ` Nikita Schmidt [this message]
1997-03-25 14:44 Floppy, finger, date Marco Corte
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