Bug 1283709 - Path traversal in `uniqueext`
Summary: Path traversal in `uniqueext`
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-19 16:12 UTC by Colin Walters
Modified: 2016-01-20 15:40 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-22 00:18:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Colin Walters 2015-11-19 16:12:37 UTC
I know mock does not really claim to be "secure", but it's worth at least keeping track of these sorts of issues for two reasons:

 - To demonstrate criteria by which an actually secure build system should be judged
 - It's worth fixing these for reliabilty reasons

# mock -r epel-7-x86_64 --init --install strace --uniqueext=/../../../tmp/foo

will create a chroot outside of /var/lib/mock in /var/tmp/foo, and I can't see anything stopping one from just overwriting the host /.

Comment 1 Miroslav Suchý 2015-12-22 00:18:48 UTC
I am not sure if this should be addressed. If your user is in 'mock' group, then you can root access anyway.
And if you provide incorrect path... well we provide gun, and you are shooting. If you want to shoot into your leg...
And btw, if you have selinux enabled, it should stop you from overwriting /.

Comment 2 Colin Walters 2016-01-20 15:40:32 UTC
(In reply to Miroslav Suchý from comment #1)
> I am not sure if this should be addressed. If your user is in 'mock' group,
> then you can root access anyway.

Right.  But given that, I feel the `mock` group is a historical mistake, as there's an implication that it provides security where it doesn't.  If a program is effectively equivalent to a root shell, it would have been beetter to require use of `sudo`.  (One could find the uid to chown result files via `SUDO_UID` etc.)  It would drop a vast amount of complexity from mock.

I'm not arguing for making this change now though, it probably isn't worth doing.

For reference I am the developer of https://git.gnome.org/browse/linux-user-chroot which I do believe is secure, and that's the specific program that I'm comparing vs mock.


Note You need to log in before you can comment on or make changes to this bug.