Container Security

Container security is protecting containerized applications, such as Docker containers and Kubernetes clusters, through their whole life: building secure images, controlling the cluster and detecting attacks while they run.

AdvancedCategory: Cloud and software supply chain

Also called: Docker security, Kubernetes security, container image security, K8s security

What is container security?

Containers package an application with everything it needs to run, so it behaves the same on a laptop, a server or in the cloud. Docker is the best-known container tool, and Kubernetes is the most common way to run many containers across a cluster of machines. NIST describes containers as operating system virtualization combined with application packaging, which makes them portable and easy to automate.

They also bring new risks. NIST's container security guide, SP 800-190, groups them into five areas: images, registries, orchestrators such as Kubernetes, the containers themselves and the host operating system.

Common risks

  • Vulnerable or malicious images: outdated base images full of known flaws, or images from untrusted public sources containing malware
  • Secrets baked into images, such as passwords and API keys
  • Containers running as root or with privileged settings, so a compromise can reach the host
  • Exposed Kubernetes dashboards and APIs, a frequent target for cryptomining gangs
  • Overly broad permissions in Kubernetes role-based access control
  • No network restrictions between containers, enabling lateral movement
  • Little runtime visibility into what containers are actually doing

Core practices

The NSA and CISA Kubernetes Hardening Guide and NIST SP 800-190 recommend, among other things:

  1. Use minimal, trusted base images and scan every image for vulnerabilities in the CI/CD pipeline and in the registry.
  2. Never put secrets in images. Use a secrets manager.
  3. Run containers as non-root with read-only file systems where possible, and avoid privileged mode.
  4. Lock down the Kubernetes API, use strong authentication and apply least privilege with RBAC.
  5. Use network policies to limit which pods can talk to each other.
  6. Turn on audit logging and runtime threat detection, for example with a CWPP.
  7. Keep Kubernetes and nodes patched. Managed services such as EKS, AKS and GKE take on part of this work.

Most small businesses don't run containers directly, but many of the software products they rely on do. If you build software, ask a penetration testing firm to include your container environment.

Related terms

Sources

  1. SP 800-190: Application Container Security Guide (NIST)
  2. Kubernetes Hardening Guide (NSA and CISA)

Drafted with AI assistance, then edited and fact-checked by a person. How we use AI.