Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 537598 - sys-apps/sandbox: does not work with set[ug]id executables
Summary: sys-apps/sandbox: does not work with set[ug]id executables
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-24 20:41 UTC by Michał Górny
Modified: 2016-03-29 12:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-01-24 20:41:21 UTC
Since libsandbox.so is not set[ug]id, it doesn't get preloaded for set[ug]id executables. Which not only means their access isn't restricted within ebuilds but also causes a lot of ugly ld.so errors:

ERROR: ld.so: object 'libsandbox.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

If the code is safe enough, I think it should be made set[ug]id. CC-ing security@ for opinion on that.
Comment 1 SpanKY gentoo-dev 2015-02-19 05:14:54 UTC
heh, it is not safe at all for set*id context, nor is it a goal to be safe.  generally speaking, you shouldn't be running set*id inside ebuilds in the first place.

we should be able to change the logic in wrapper-funcs/__wrapper_exec.c to use ptrace when running a set*id ELF.  it would mean some might break (like sudo will crap out), but that's probably for the best anyways.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-02-21 10:21:37 UTC
Well, I don't need this anymore, just left the bug in case.

Wouldn't it be better to prohibit setuid in ebuilds completely? Any idea how to do that?
Comment 3 SpanKY gentoo-dev 2015-02-21 18:59:04 UTC
(In reply to Michał Górny from comment #2)

i described where we can catch that.  i don't think it's possible to ban execution of set*id entirely because some packages run like `mount --help`.  as long as we ptrace them, the kernel won't grant the runtime env set*id permission.
Comment 4 SpanKY gentoo-dev 2016-03-29 12:42:29 UTC
i've implemented ptrace for pretty much every arch now in sandbox-2.11 (ignoring sparc's disable due to bug 293632 which i think is kernel related).  not much else to be done here.

ftr, 2.11 supports (and passes tests on):
  alpha amd64 arm hppa ia64 ppc ppc64 s390 s390x

if i can get a real system to test on, an arm64 port will be pretty quick.
i guess i'm also missing mips, but eh.