Escaping Docker Containers

I recently came across this article describing 7 ways to escape a container.

You should read it if you’re conscious of your container security.

I want to point out that most of the listed container escape techniques require additional Linux capabilities.

You can set these capabilities in Kubernetes in a pod’s security context. Here’s what that might look like and link to the docs:

apiVersion: v1
kind: Pod
metadata:
  name: security-context-demo-4
spec:
  containers:
  - name: sec-ctx-4
    image: gcr.io/google-samples/node-hello:1.0
    securityContext:
      capabilities:
        add: ["NET_ADMIN", "SYS_TIME"]

It’s a huge security smell if you grant your Kubernetes workloads additional Linux capabilities.

Avoid adding additional capabilities unless you know what you’re doing and audit your cluster for any pods doing so.


Master GitHub Actions with a Senior Infrastructure Engineer

As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.

Not sure yet? Check out the archive.

Unsubscribe at any time.