Re: No Root Shell with SUID /bin/bash

From: Joachim Blaabjerg (styx@SuxOS.org)
Date: 04/24/02


From: Joachim Blaabjerg <styx@SuxOS.org>
To: Peter Pan <radiodrinker@yahoo.de>
Date: Tue, 23 Apr 2002 22:02:46 +0000

On Saturday 20 April 2002 08:22, Peter Pan wrote:

> setuid(0);
> if(getuid()){
> printf("must be suid root.\n");
> } else {
>
<snip>
> system("/bin/sh");
<snip>

Hm... Wouldn't it be an idea to postpone that setuid(0) to _after_ you're
checked that the md5sums match (optionally change back to the old uid after
you've verified that you have permission to setuid(0))? I guess it doesn't
have any practical effect, but it's a matter of good programming practice. A
program doesn't need to have root privileges to get the password and verify
it. Image the scenario that there is a vulnerability in the hexToString
function. That piece of good programming practice would make all the
difference in the world... ;)

Regards,

-- 
Joachim Blaabjerg
styx@SuxOS.org
www.SuxOS.org



Relevant Pages

  • Re: EVENT variables
    ... entire aspect of the language, because it has become effectively obsolete, which is what I said over a week ago. ... Current programming practice is to use threads if buffering is not satisfactory, operating systems reflect that, and so does current PL/I. ...
    (comp.lang.pl1)
  • Re: Copyrights
    ... It's not just Peter Pan, but I think the other perpetually copyrighted ... documents are under crown copyright. ... friendly policy where any government document is public domain). ...
    (uk.legal)
  • Re: EVENT variables
    ... entire aspect of the language, because it has become effectively obsolete, which is what I said over a week ago. ... Current programming practice is to use threads if buffering is not satisfactory, operating systems reflect that, and so does current PL/I. ...
    (comp.lang.pl1)
  • Re: Abiogenesis
    ... posted by Peter Pan: ... life on earth. ...
    (talk.origins)
  • Re: trying to use IO::Handle
    ... a global variable, using global variables defeats ... modularization and is bad programming practice to boot. ...
    (perl.beginners)