Skip to contentSkip to conversation

capabilities patch (v 0.1)

DISCUSSION Bodo Eggert 5 participants 8 messages Aug 9, 2005 – Aug 10, 2005 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 9 lines · Chris Wright
Quoted 2 lines · * David Madore ([email protected]) wrote:

* Second, a much more extensive change, the patch introduces a third set of capabilities for every process, the "bounding" set. Normally

this is not a good idea. don't add more sets. if you really want to work on this i'll give you all the patches that have been done thus far, plus a set of tests that look at all the execve, ptrace, setuid type of corner cases.

How are you going to tell processes that may exec suid (or set-capability-) programs from those that aren't supposed to gain certain capabilities?

Signature · 2 lines
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.
#3 lore raw
Quoted 6 lines · * Bodo Eggert ([email protected]) wrote:
Quoted 5 lines · Chris Wright
Quoted 2 lines · * David Madore ([email protected]) wrote:

* Second, a much more extensive change, the patch introduces a third set of capabilities for every process, the "bounding" set. Normally

Quoted 7 lines
Quoted 4 lines

this is not a good idea. don't add more sets. if you really want to work on this i'll give you all the patches that have been done thus far, plus a set of tests that look at all the execve, ptrace, setuid type of corner cases.

How are you going to tell processes that may exec suid (or set-capability-) programs from those that aren't supposed to gain certain capabilities?

typically you'd expect exec suid will reset to full caps.

#4 lore raw
Quoted 5 lines · Chris Wright
Quoted 2 lines · * Bodo Eggert ([email protected]) wrote:

How are you going to tell processes that may exec suid (or set-capability-) programs from those that aren't supposed to gain certain capabilities?

typically you'd expect exec suid will reset to full caps.

suid exec _must_ reset to full caps or we have the sendmail disaster again. However, that is _if_ execve() succeeds. It is quite possible that execve() should fail, and that is precisely what my patch does:
if a process has bounded capabilities, it _may not_ exec suid.

Signature · 3 lines
     David A. Madore
    ([email protected],
     http://www.madore.org/~david/ )
#5 lore raw
In reply to Chris Wright
Quoted 12 lines · Chris Wright
Quoted 11 lines · * Bodo Eggert ([email protected]) wrote:
Quoted 9 lines · Chris Wright
Quoted 2 lines · * David Madore ([email protected]) wrote:

* Second, a much more extensive change, the patch introduces a third set of capabilities for every process, the "bounding" set. Normally

this is not a good idea. don't add more sets. if you really want to work on this i'll give you all the patches that have been done thus far, plus a set of tests that look at all the execve, ptrace, setuid type of corner cases.

Quoted 4 lines
Quoted 2 lines

How are you going to tell processes that may exec suid (or set-capability-) programs from those that aren't supposed to gain certain capabilities?

typically you'd expect exec suid will reset to full caps.

ACK, but

1) I wouldn't want an exploited service to gain any privileges, even by chaining userspace exploits (e.g. exec sendmail < exploitstring). For most services, I'd like CAP_EXEC being unset (but it doesn't exist).

2) There are environments (linux-vserver.org) which limit root to a subset of capabilities. I think they might use that feature, too. Off cause a simple "suid bit" == "all capabilities" scheme won't work there.

Signature · 2 lines
"Just because you are paranoid, do'nt mean they're not after you."
	-- K.Cobain
#6 lore raw
Quoted 3 lines · Bodo Eggert

1) I wouldn't want an exploited service to gain any privileges, even by chaining userspace exploits (e.g. exec sendmail < exploitstring). For most services, I'd like CAP_EXEC being unset (but it doesn't exist).

I intend to add a couple of capabilities which are normally available to all user processes, including capability to exec(), capability to fork() and a couple of others (maybe a capability to perform any kind of write operation, but that seems a bit more difficult to implement). So keep an eye open[#] for future versions of my patch.

Signature · 6 lines
     David A. Madore
    ([email protected],
     http://www.madore.org/~david/ )

[#] On the other hand, I have a strong tendency not to finish anything
I start :-( so maybe this is all just vaporware.
#7 lore raw
Quoted 2 lines · David Madore

I intend to add a couple of capabilities which are normally available to all user processes, including capability to exec(), [...]

Once you have a mechanism that lets you prevent the untrusted program from exec-ing a setuid/setgid program (such as your bounding set idea), I don't see any added value in preventing the program from calling exec().

"Don't forbid what you can't prevent". The program can always emulate the effect of exec() in userspace (for non-setuid/setgid programs) -- doing so is tedious, but nothing prevents a malicious userspace program from implementing such a thing, I think.

This is only a comment on forbidding exec(), not on anything else in your proposal.

#8 lore raw
In reply to Bodo Eggert
Quoted 3 lines · * Bodo Eggert ([email protected]) wrote:

1) I wouldn't want an exploited service to gain any privileges, even by chaining userspace exploits (e.g. exec sendmail < exploitstring). For most services, I'd like CAP_EXEC being unset (but it doesn't exist).

Don't let it exec things it shouldn't. This can be done with namespaces or for finer-grained, that is what smth like SELinux is made for.

Quoted 3 lines

2) There are environments (linux-vserver.org) which limit root to a subset of capabilities. I think they might use that feature, too. Off cause a simple "suid bit" == "all capabilities" scheme won't work there.

IIRC, they effectively use the bounded set as per-context. So it'd not make any difference there.

thanks,
-chris

#9 lore raw
Quoted 8 lines · Chris Wright
Quoted 3 lines · * Bodo Eggert ([email protected]) wrote:

1) I wouldn't want an exploited service to gain any privileges, even by chaining userspace exploits (e.g. exec sendmail < exploitstring). For most services, I'd like CAP_EXEC being unset (but it doesn't exist).

Don't let it exec things it shouldn't. This can be done with namespaces or for finer-grained, that is what smth like SELinux is made for.

Namespaces may be OK for bind, but things like samba can't really use them and SELinux sounds more heavyweight (for brain and CPU).

Quoted 6 lines
Quoted 3 lines

2) There are environments (linux-vserver.org) which limit root to a subset of capabilities. I think they might use that feature, too. Off cause a simple "suid bit" == "all capabilities" scheme won't work there.

IIRC, they effectively use the bounded set as per-context. So it'd not make any difference there.

It could possibly be combined into one mechanism (less intrusive patch).

Signature · 2 lines
Funny quotes:
14. Eagles may soar, but weasels don't get sucked into jet engines.