9 points · by hardenedlinux · 7mo ago · 8 comments
It's mildly interesting that they didn't call exec() and parse the elf manually, but that's about it.
That is what os dangerous, especially with containers where people run with the container root with elevated privileges.
With ollama, llama.cpp, and many other often agent containers that will run arbitrary code, and are running with the ability to bypass MACs, plus the fact that vfs and IPC isn’t really namespaces away it is complicated.
When you can’t even convince popular funded projects to add ‘USER foo’ to a dockerfile, this method is trivial.
If you looked into the state of lsms and how every complicated or difficult project is basically unconstrained it should be concerning.
~15 lines of c and ld_preload gets you privileged user namespaces on Debian based systems because of busybox as an example, which is a required package yet privileged in apparmor
In the K8s world you should expect the kubelet or any containers, regardless of namespace to be open to data leakages and there may be c2 configurations that will hide from your auditing tools.
Like much of the security industry protections are reactive, with the number of bind mounts being an indicator.
The problem is that namespaces and thus containers are not in themselves a security feature, and if you don’t implement the privilege dropping that can help them be a portion of a larger security posture you lose a lot of security.
The larger problem is that namespace support is an explicit addition to kernel features, with the default always being the global namespace.
Different teams working on different projects may not have compatible decisions.
E.g. vsock was built under a trusted hypervisor model, systemd wanted zero config for user experience reasons and OCI blocks vsock because it is insecure.
So podman, browser plugins and anything in a ‘sandbox’ have a container host ssh instance to and move horizontally.
As vsock is just another af, no special user code is needed.
Running all your containers as a single uid will elevated privileges, with global uid/gid make a needle in a haystack problem easier because you are effectively handing them a magnet
If you have arbitrary code execution, you can execute more arbitrary code on disk without calling exec. Better yet if you care about stealth is to not touch the disk at all, and keep everything in memory, downloading your next stage from a server directly into RAM.