public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@stanford.edu>
To: Olaf Dietsche <olaf+list.linux-kernel@olafdietsche.de>
Cc: Andy Lutomirski <luto@myrealbox.com>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	akpm@osdl.org, torvalds@osdl.org
Subject: Re: [PATCH, local root on 2.4, 2.6?] compute_creds race
Date: Sat, 10 Apr 2004 11:59:22 -0700	[thread overview]
Message-ID: <4078440A.9050909@stanford.edu> (raw)
In-Reply-To: <87isg7zndy.fsf@goat.bogus.local>



Olaf Dietsche wrote:
> Andy Lutomirski <luto@stanford.edu> writes:
>>Olaf Dietsche wrote:
>>>Andy Lutomirski <luto@myrealbox.com> writes:
>>>
>>>
>>>>The setuid program is now running with uid=euid=500 but full permitted
>>>>capabilities.  There are two (or three) ways to effectively get local
>>>>root now:
>>>
>>>What about this slightly shorter fix?
>>>diff -urN a/fs/exec.c b/fs/exec.c
>>>--- a/fs/exec.c	Fri Mar 12 01:19:06 2004
>>>+++ b/fs/exec.c	Sat Apr 10 10:54:20 2004
>>>@@ -942,6 +942,9 @@
>>> 			if(!capable(CAP_SETUID)) {
>>> 				bprm->e_uid = current->uid;
>>> 				bprm->e_gid = current->gid;
>>>+				cap_clear (bprm->cap_inheritable);
>>>+				cap_clear (bprm->cap_permitted);
>>>+				cap_clear (bprm->cap_effective);
>>> 			}
>>> 		}
>>> 	}
>>
>>This makes the bprm_compute_creds hook even less sane than now
>>(i.e. it assumes that all LSMs will work like the current capability
>>modules).  The hook should allow LSM to change this functionality
>>without reintroducing the race.  For example, it breaks my work on
>>fixing capabilities.
> 
> 
> This patch fixes the problem without moving and renaming huge amounts
> of code. And the hook is still in place, so I don't see your problems.
> 
> If you look at the code - as seen in 2.4 and early 2.5 - that's (more
> or less) the place where the fix should be.

With your patch, compute_creds tries assumes that, if a program is not setuid, 
it should clear all capabilities.  This would be very wrong if capabilities 
worked right.

It may also be wrong with the current caps code.  If root execs a setuid-nonroot 
program from a thread, your patch looks like the program will start up as root 
but without capabilities.  I don't see a trivial fix for it, short of moving 
some code.

--Andy

> 
> Anyway, I don't really object against moving code around.
> 
> Regards, Olaf.

  reply	other threads:[~2004-04-10 19:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-09 18:49 [PATCH, local root on 2.4, 2.6?] compute_creds race Andy Lutomirski
2004-04-09 20:43 ` Chris Wright
2004-04-09 20:53   ` Andy Lutomirski
2004-04-10  9:16 ` Olaf Dietsche
2004-04-10 15:40   ` Andy Lutomirski
2004-04-10 18:41     ` Olaf Dietsche
2004-04-10 18:59       ` Andy Lutomirski [this message]
2004-04-10 10:32 ` Olaf Dietsche
2004-04-12 18:40   ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4078440A.9050909@stanford.edu \
    --to=luto@stanford.edu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@myrealbox.com \
    --cc=olaf+list.linux-kernel@olafdietsche.de \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox