Docker Bug Allows Root Access to Host Filesystem
decipher.sc
decipher.sc
It should be used to ease deployment.
If you put docker inside a VM, and your hypervisor is running in a zone, and you have different zones based on ”role”. Then of course you get the benefits of the zone and the hypervisor.
The parent said “docker solves deployment, not isolation”- if you get your isolation another way then there’s no issue with using docker.
Docker does have fairly good support for SELinux built in tho (which counts as "using Docker" in my book).
And I do like that Docker makes the SELinux fairly straight forward for the simplest usecases (adding :z or :Z to volume directives).
Run well written software. As a user. In a cgroup. With SELinux. On a VM. On Different Tin. With a security monitoring. Patch.
The analogy you're trying for is surely not that this is as likely to solve the deployement problem for most people just as "Eat food. Not too much. Mostly Plants" is to solve the obesity epidemic for most people ? Not at all ?
I probably wouldn't want a fat PT, the same I don't want my sysadmin to be running apps as root.
Problem there is it requires a significant learning curve and when you get to that point you start evaluating the ROI of containers. Deployment is easy. Operations is easy. Until either one of the two fail. Then debugging becomes a seriously complex problem.
This is kind of a stinky one, though because docker runs in the root context (unless you are experimenting with the rootless docker mode).
You could take this same argument to absurd extremes: the kernel is just an abstraction over the hardware, surely you could ditch the kernel and manage the hardware yourself and it will be more secure.
The reality is, in both cases, no you can't. Doing this stuff right requires expertise, and generally need more than one or two people looking at it.
More than a few, less than a horde
VM's provide a large attack surface, while one CAN restrict containers sufficiently. See contained.af. Doesnt mean Docker does this though.
Simply speaking, VMs only need to properly take care of a few privileged CPU opcodes.
Bryan expresses his opinions on this. When you say Isolate that really should include security.
All of that being said, this bug is caused by container runtimes trusting the rootfs too much. This is something I've been trying to improve but it's definitely not a trivial problem (lots of things require trusting the container processes in specific ways due to limitations in the corresponding kernel APIs -- though I am working on fixing those too).
[1] https://lists.archlinux.org/pipermail/arch-general/2017-Febr...
But, in the case of running things in containers, you can stop exploits of user namespaces through seccomp filters that block unshare(CLONE_NEWUSER) -- Docker does this by default.
Red Hat created a Kubernetes compatible set of tools for running Docker compatible OCI containers called CRI-O https://cri-o.io/ with RHEL/Centos 7.7 and 8+ you can run containers as a regular user: https://www.redhat.com/en/blog/preview-running-containers-wi... using their tools.
An unprivileged-user docker daemon would be limited to either communicate with an isolated network namespace on the parent side or do userspace forwarding of network traffic. Or it would require a privileged helper for the network parts.
The main thing about it is cgroups are disabled and it requires userspace networking.
Here's a write-up on it: https://engineering.docker.com/2019/02/experimenting-with-ro...
From reading the article it appears the issue is in Docker, not the container mechanism offered by the kernel upon which Docker builds.
I do agree that a it's important to have defence in depth
Well, thousands of companies, such as ISPs offering VPS are using containers for exactly that reason. Containers use cgroups under the hood, a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes. As long as there aren't any bugs in the kernel related to cgroups, security is provided.
Saying containers shouldn't be used for security is like saying kernel functions shouldn't be used for security.
The problem with docker isn't at the kernel level, it's the userspace tooling. It's pretty insecure by default. For example it creates bridged networks as the default network interface and actively encourages (by design) developers to run code as root (since creating non-root users then becomes a manual RUN command). Then you have vulnerabilities in the user space tools to contend with in addition to the same concerns about sharing a kernel that crop up when discussing security and containerisation. That said, there are some stuff it does right from a security standpoint but generally speaking docker is a tool you need to harden rather than something that comes hardened.
I don't hate docker though. It's a great productivity tool and it can be run securely if you have proper defence of depth. But I would advise against running docker as your only sandboxing. To be honest, I'd advise security at all levels regardless of the docker discussion anyway.
Docker has always been sold as more of an development and orchestration tool than a security one.
https://penguindreams.org/blog/my-love-hate-relationship-wit...
Having said that, I agree that by default containers are a poor security boundary - but saying they are wholesale inadequate is not accurate.
There are things that can be done to enhance the defaults that docker currently provides (b/c defaults are hard to change when you have millions of users), but a process running in a default docker container is absolutely more secure than a process running outside of a container.
It's perfectly possible to fire up a regular docker container inside KVM or whatever. With constant container security issues, why isn't this the norm?
https://clearlinux.org/news-blogs/intel-clear-containers-now... https://katacontainers.io/
Exposing GPU resources is also a lot easier with containers than with VMs.
can someone make a real use case of this bug?
because it's easy to do something such as :
$ docker run -it -v /:/hostfs debian chroot /hostfs
# I'm root !