New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker images can contain SUID binaries #229
Comments
Can't docker mount its filesystems as nosuid? |
I searched for this, but couldn't find it. I don't think that it is possible. I also found many claims that it is not desireable, because most distributions rely on nosuid for core functionality. I haven't verified that second part yet. |
I thought they could. For example, this article mentions:
Even if that's not the case, this article takes a different approach, by removing suid permissions from files manually, in the dockerfile itself. This could be used as a work-around, I guess. |
Yes, I saw that article. Which really seems to give the impression that the only way is to remove suid bits. We even have a good place to put that code: https://github.com/subuser-security/subuser/blob/master/logic/subuserlib/classes/subuserSubmodules/run/runReadyImage.py#L38 However, any time one adds code that gets run within the image, that code has to be extremely portable. Preferably POSIX compliant shell. (Or I guess it might be possible to use a statically linked binary, but that has other complications with compiling/distribution ect.) |
If you want to play with this, I would suggest, writing some really crapy code quickly, to get rid of the suid bits and see if anything breaks. Don't invest a lot of time in it, untill you know that normal applications have a chance of working without suid bits in the system :) |
Oops, I just realized that modifying the run ready image Dockerfile might not work in this case because it would be possible for a malicious image to interfere with any script that we inserted there. I'm not sure if it would be possible for a malicious image to interfere with a statically linked binary though. |
Assuming we trust the docker image not to interfere, for example the only attacks we are worried about would come from outside WHILE using the sandboxed application (for example, browser exploits), removing SUID bits while building the dockerfiles would be enough, right? |
I added this to my dockerfile, right at the end:
I know this isn't POSIX compliant and all, but I wanted something quick. It seems to work perfectly fine. I can then run bash under the subuser, and am not able to find a single SUID binary. Meanwhile, Firefox (+ fresh-player/pepper-flash Flash; and audio through Pulseaudio), Thunderbird and qBittorrent still seem to work perfectly fine. The SUID binaries of course stop working without "sudo" (for example, 'ping www.google.com' gives an error), but that doesn't matter much. |
Thank you for testing this out. I will resolve this once a good, elegant, solution appears. Which might not be untill subuser moves from working through Docker to calling runc directly. |
@timthelion I think that subuser should not run as root (like xdg-app) because if a application escapes the sandbox then they have root (I think it is better to run my web browser outside subuser) Also take a look at how |
First off, subuser itself does not ever run as root, Docker does. But
This makes Docker quite secure. It is not perfect, but in no way is it Subuser further provides several security advantages:
The bug report that you are commenting on, about SUID binaries, only The fact is, that iceweasel or chromium or whichever web browser you The most likely vectors of attack against subuser and xdg-app are via On 04/08/16 16:40, Suici Doga wrote:
|
You can forbid suid in container with |
This means that all subusers can be considered to have root WITHIN THE CONTAINER. This bug will be resolved once usernamespaces are a thing in runc/Docker.
The text was updated successfully, but these errors were encountered: