Re: Glitch in sys_chroot()

Kai Henningsen (kai@khms.westfalen.de)
17 Nov 1996 11:21:00 +0200


alan@lxorguk.ukuu.org.uk (Alan Cox) wrote on 16.11.96 in <m0vOm8o-0005KgC@lightning.swansea.linux.org.uk>:

> > Sorry, what should this code do? I tried it on several machines (NetBSD
> > among others), and experienced nothing but what I expected, namely a login
> > shell in the root (/) directory. The same thing you can achieve by
> > (cd /; sh -login)
> > What am I missing? What do you want to demonstrate?
>
> If you are locked into an anonymous ftp area for example and manage to
> execute programs, the normal assumption is you cannot get out of that
> chroot area. The program above does if you can get to be root. Thus it
> makes it much harder to create an area on a machine you cannot break out
> from

Oh yes. Much, much harder. You actually have to insert a chdir() in the
same source that you put the chroot() into in the first place.

Just like in (nearly?) every other Unix around.

Get real.

MfG Kai