From: Shriman Gurung <shriman@well.ox.ac.uk>
Subject: Re: --> How can *I* reboot my machine? <--
Date: 1996/07/24 [thread overview]
Message-ID: <Pine.SOL.3.94.960724151033.26198B-100000@flemming> (raw)
In-Reply-To: 4t07ij$6dh@news.iastate.edu
Doesn't the sudo package address this sort of problem? It allows
a root-ish sort of command (eg reboot, shutdown etc) to be run by
a certain class of user (mentioned in the sudoers file) without knowing
the root password. Try sunsite for the source (or archie).
Shriman Gurung
shriman@well.ox.ac.uk
On 22 Jul 1996, John Hascall wrote:
> Andrew Gierth <andrewg@microlise.co.uk> wrote:
> }>>>>> "Tom" == Tom Regan <tomr@pinn.net> writes:
> } Tom> Write a short C program (call it rboot)
> } Tom> main()
> } Tom> {
> } Tom> setuid(0);
> } Tom> setgid(0);
> } Tom> system("/usr/sbin/reboot");
> } Tom> exit (0);
> } Tom> }
> } Tom> Set the owner to root, and chmod 4755.
> }Just so you all know, on many systems this allows unlimited root access
> }to be obtained trivially.
> [...example...]
> }system() in a setuid program is a notorious source of holes. The
> }correct version of the program is:
> }#include <unistd.h>
> }#include <stdio.h>
> }int main(void)
> }{
> } setuid(0);
> } setgid(0);
> } execl("/usr/sbin/reboot","reboot",NULL);
> } perror("exec");
> } return 1;
> }}
> }Assuming /usr/sbin/reboot is an executable and not a shell script, the
> }above should be reasonably safe.
>
> Or even simpler:
>
> #include <sys/reboot.h>
> int main (
> int argc,
> char ** argv
> ) {
> return reboot(RB_AUTOBOOT);
> }
> (install owner=root group=those-allowed-to-reboot mode=4750)
>
>
> John
> --
> John Hascall, Software Engr. Shut up, be happy. The conveniences you
> ISU Computation Center demanded are now mandatory. -Jello Biafra
> john@iastate.edu
> http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud
>
>
next prev parent reply other threads:[~1996-07-24 4:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-19 4:00 --> How can *I* reboot my machine? <-- D. White
1996-07-20 4:00 ` Tom Regan
1996-07-20 4:00 ` Andrew Gierth
1996-07-22 4:00 ` John Hascall
1996-07-24 4:00 ` Shriman Gurung [this message]
1996-07-24 4:00 ` Tim Mooney
1996-07-26 4:00 ` Heiner Steven
1996-07-30 4:00 ` R Denholm
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