public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* EUID != root + EGID = root, and CAP_SETGID
@ 2009-12-11 11:25 Ivan Zahariev
  2009-12-11 12:04 ` Andreas Schwab
  2009-12-13  5:19 ` David Wagner
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Zahariev @ 2009-12-11 11:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ivan Zahariev

Hi guys,

Currently, if a process is started with EUID which is non-root, and EGID 
which IS root (for example by set-group-ID file permission + file group 
owner "root", or an account in /etc/passwd with group=0), then the 
processes is not granted CAP_SETGID.

As a result, such a process cannot change its EGID to an arbitrary one, 
even though the current EGID is the super-user "root" one. Therefore, 
such a process cannot easily drop its EGID "root" privileges to non-root 
ones, for security reasons.

This is not the case if the process starts with EUID=0. Then the 
processes is granted *both* CAP_SETUID and CAP_SETGID.

Is this an intended behavior? Shouldn't a process which is started with 
EGID=0 get CAP_SETGID too?

Thank you.

Best regads,
Ivan Zahariev

P.S. For more detailed info: 
http://blog.famzah.net/2009/12/11/linux-non-root-user-processes-which-run-with-group-root-cannot-change-their-process-group-to-an-arbitrary-one/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: EUID != root + EGID = root, and CAP_SETGID
  2009-12-11 11:25 EUID != root + EGID = root, and CAP_SETGID Ivan Zahariev
@ 2009-12-11 12:04 ` Andreas Schwab
  2009-12-13  5:19 ` David Wagner
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2009-12-11 12:04 UTC (permalink / raw)
  To: Ivan Zahariev; +Cc: linux-kernel

Ivan Zahariev <famzah@icdsoft.com> writes:

> As a result, such a process cannot change its EGID to an arbitrary one,
> even though the current EGID is the super-user "root" one.

There is no such thing as a "super-user group".  No group has any
special privleges.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: EUID != root + EGID = root, and CAP_SETGID
  2009-12-11 11:25 EUID != root + EGID = root, and CAP_SETGID Ivan Zahariev
  2009-12-11 12:04 ` Andreas Schwab
@ 2009-12-13  5:19 ` David Wagner
  1 sibling, 0 replies; 3+ messages in thread
From: David Wagner @ 2009-12-13  5:19 UTC (permalink / raw)
  To: linux-kernel

Ivan Zahariev  wrote:
>Is this an intended behavior?

Yes.  Setuid/setgid are a mess.  For more details, you might
find the following research papers interesting:

http://www.cs.berkeley.edu/~daw/papers/setuid-usenix02.pdf 
http://www.cs.berkeley.edu/~daw/papers/setuid-login08b.pdf 

See, e.g., Section 5.2 of the former paper, which says:

  "an effective group ID of zero does not accord any
  special privileges to change groups. This is a potential
  source of confusion: it is tempting to assume incorrectly
  that since appropriate privileges are carried by the euid
  in the setuid-like calls, they will be carried by the
  egid in the setgid-like calls, but this is not how it
  actually works. This misconception caused a mistake in
  the manual page of setgid in Redhat Linux 7.2 (Section
  6.4.1)."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-13  5:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-11 11:25 EUID != root + EGID = root, and CAP_SETGID Ivan Zahariev
2009-12-11 12:04 ` Andreas Schwab
2009-12-13  5:19 ` David Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox