./sudo vi

John E Hein at work jhein at timing.com
Thu Jun 21 13:09:00 EDT 2001


Boehler, Joe wrote at 10:51 -0500 on Jun 21:
 > Is there a way to prevent an unauthorized user gaining access to root by
 > using the vi command?
 > 
 > For example
 > 
 > ./sudo vi /tmp/tst
 > 
 > Once vi opens test
 > 
 > !/bin/ksh

1) compile vi so it disallows !
    (but there's nothing to prevent a user from building
     their own vi in /tmp)

2) edit sudoers to prevent some from running vi
    (but there's nothing to prevent a user from running
     yoyoma which is what the renamed the vi they just built in /tmp)

3) edit sudoers to allow only a specific set commands (specified with
    absolute pathnames)

Even if you try to do 1 & 2, they can still always do 'sudo /bin/ksh'.
 You don't need vi to do that.

#3 is really the only way.

If you still want them to be able to use an
 editor, specify an editor (again, full pathname) in sudoers that won't
 allow such trickery (i.e., spawning other processes).

Of course, that won't prevent the user from adding their own user (foo)
 to a flat password file that happens to have a password-less account
 with a userid of 0.  This won't work on systems where a password file
 is compiled to a database file, but you get the idea... there's more
 than one way to skin a super-user.



More information about the sudo-users mailing list