3 ms·
Thanks for commenting here! I was inspired by sandstorm's supervisor.c++ while looking into container security which actually eventually led me to this issue.
by bthornbury 9y ago
Thanks for commenting here!
I was inspired by sandstorm's supervisor.c++ while looking into container security which actually eventually led me to this issue.
> For example, Docker mounts /proc, albeit read-only;
I can't find too much information on this, does docker mount /proc from the host by default in each of the containers?
> In general, if you are going to run possibly-malicious code, the better way to reduce your risk is not to use a better sandbox, but to use multiple layered sandboxes. The effect is multiplicative: now the attacker must simultaneously obtain zero-days in both layers. For example, Google Chrome employs the V8 sandbox as well as a secondary container-based sandbox.
I think that sandboxing the language is pretty tough in the general case, since every language takes a lot of effort. In non-managed, compiled languages, it will be even tougher.
What is your opinion on tools like SELinux as a secondary layers?
- paulfurtado 9y ago> I can't find too much information on this, does docker mount /proc from the host by default in each of the containers? I'm curious what kentonv has to say, but on modern kernels docker can make use of PID namespaces, so /proc only shows PIDs from the container's PID namespace. That said, it does still provide several information leaks like /proc/self/mountinfo showing which host directories are mounted where in the container. In addition to PID namespaces, another isolation gotcha is users, and docker does not enable user namespaces by default since it's a relatively new kernel feature and it breaks backwards compatibility (ex: kubernetes doesn't yet support them). A good example of this in practice that many people hit issues with in the past was ulimits: if UID 1000 in a container exceeds a ulimit, it also affects UID 1000 in every other container. Docker solved this by setting ulimits to unlimited on the docker daemon process, which are then inherited by containers (this also happens to be good for performance). User namespaces are one of the big recent improvements to container security.
- kentonv 9y ago> I can't find too much information on this, does docker mount /proc from the host by default in each of the containers? Sorry, I should have clarified: It's /proc for the specific PID namespace. So in theory it doesn't leak anything bad. The problem is that it's a huge attack surface; there have been bugs in /proc before. > I think that sandboxing the language is pretty tough in the general case, since every language takes a lot of effort. In non-managed, compiled languages, it will be even tougher. WebAssembly sandboxes non-managed compiled languages pretty well. :) > What is your opinion on tools like SELinux as a secondary layers? IMO it doesn't help very much, because many of the kinds of kernel bugs that allow you to escape a container tend to allow you to escape SELinux as well.