Process building package can escape from chroot and gain local root

Bug #1010787 reported by Karma Dorje
260
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sbuild (Debian)
Fix Released
Unknown
sbuild (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Package: sbuild
Version: 0.62.6-1
Severity: important

When building a package with sbuild, the processes running in the chroot can escape from there and gain local root. This is possible as the processes in- and outside of the chroot environment run under the same user id and the outside process can run commands as root in the chroot environment.

Changed in sbuild (Debian):
status: Unknown → New
Karma Dorje (taaroa)
visibility: private → public
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for reporting a bug in Ubuntu. I'm not following your reasoning. Chroots are not designed to provide a security barrier for root processes, so, like you say, a root process can break out. However, typical usage of sbuild is with schroot and packages that are built in the chroot should not be running as root. Therefore a user in the schroot should not be able to gain root in the manner described unless the chroot is misconfigured -- can you provide specifics? All that said, building untrusted packages means running untrusted code and a chroot should not necessarily be relied on for security (one can use snapshotted or throwaway virtual machines for this sort of thing).

Changed in sbuild (Ubuntu):
status: New → Incomplete
Revision history for this message
Seth Arnold (seth-arnold) wrote :

I think what Karma was suggesting is that a process executing inside the schroot environment can use ptrace(2) to attach to a process outside the schroot environment. Such a process will probably have the ability to run:

schroot -c <foo> -u root <arbitrary root-level command>

Of course, on Ubuntu kernels, the ptrace(2) attachment will fail due to:

kernel.yama.ptrace_scope = 1

Revision history for this message
Karma Dorje (taaroa) wrote :

thanks for taking the time to explain everything.
should I mark this bug as invalid? i think so.

Changed in sbuild (Ubuntu):
status: Incomplete → Invalid
Changed in sbuild (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.