198 points · by ingve · 7y ago · 48 comments
Also a good demonstration of how runc container security is really just Linux security, and the isolation provided by that type of container, is dependent on underlying Linux features.
I could see circumstances where this would be of practical use, where you've landed in a privileged container and are looking for a relatively easy/universal breakout to the underlying node.
The ToB breakdown is cool too as the initial tweet was a bit hard to parse, unless your Bashfu is good.
(ofc the post from ToB I'm really looking forward to hasn't been released yet, which is what they found in the Kubernetes audit)
1. Docker is not synonymous with Linux containers. LXC for example has always had much better security than Docker despite using the same infrastructure.
2. You don't need to interface the kennel directly. There is for example a Google project (gvisor?) that acts as a syscall proxy in userland to combat these types of problems.
LXC main dev is on HN. I'm sure he can explain this much better.
LXC had unprivileged container support since 2013 so that part is fairly mature now. 'Unprivileged' in this case means the container process itself is running as a normal user.
(as a mitigation)
okay, but even for official images, figuring out the provenance of a build on docker hub is totally impossible
I challenge you to start with an image sha and tell me what git version (or even what repo) was used to create it
docker needs to get better at supply chain
The number of people who do it in production is correlated with the complexity of the thing they are trying to do and how much the "fuck it, just do <some terrible idea>" relieves that complexity.
Because of this escape, giving access to /var/run/docker.sock to regular users is the same as giving them root access.
Also as the article says mounting /var/run/docker.sock is (now, because of this escape) the same as giving that container access to the host system.
docker run -itv /:/host ubuntu chroot /hostThe idea, of course, is to minimize the surface area for attacks. That container has a need for it to run that way; the vast majority of our other containers do not.
Ironically, attackers would have access to more valuable data (and more freedom of movement) on your personal/dev box than on a monitored production host.
The title should not in this case be editorialized; relative to the topic, it's about as boring as titles come.
But on the occasion that they're necessary, isolating from other pods with a network policy and having no public ingress is enough right?
Assuming of course that you trust the container process(es) - or is that the issue?
For example if you're running Kubernetes, then if you have a user who has RBAC rights to exec into a privileged pod, but doesn't have rights to create new privileged pods, then this could be a privesc risk, as they can use something like this to escalate to the underlying node after exec'ing into the privileged pod.
It (as with all things security) depends on your threat model :)
As far as I can tell, as long as there is no service/ingress on the privileged container, and a netpol blocks those that do from accessing it, it's less than ideal but 'ok' that this privileged container is running behind the scenes.
This is like acting surprised that a Linux root user can do immeasurable harm to the underlying OS.
Yes, the container runs in the "unconfined" profile after a restart.
Right, what you want is “privileged except for XYZ”, which is not supported by Docker. That’s a missing feature which is not the same as a bug. Calling it a security bug is even more misleading.
> Sometimes that happens, sometimes it does not. And when it does not, you have no way of knowing.
Right, it should fail every time. That is a bug. But it’s not security bug, and fixing that bug won’t give you the feature you want, it will just make it clearer that the feature is not supported.