Containers
Containers are great... but you must secure them!
About
Containers have revolutionized the way applications are developed, deployed, and managed. They provide a lightweight, standalone, executable package that includes everything needed to run a piece of software, including the code, a runtime, system tools, system libraries, and settings. Containers are portable across different platforms and they offer a consistent environment, which is a major advantage for developers and system administrators.
Nevertheless, a container is not "secure by itself"... a container include code binaries, configuration files, dependencies, the host environment, network configurations... Each of these can cause an attack surface [1].
Container security involves defining and adhering to build, deployment, and runtime practices that protect a Linux container—from the applications they support to the infrastructure they rely on [2].
Best practices
Here are some Container security best practices [1][2][3][4][5]:
Checkout the OWASP Docker Security Cheat Sheet
Cloud / Registries
Some cloud offerings, related to container image registries and registries services offers vulnerability scanning and assessment:
AWS Elastic Container Registry (ECR): AWS ECR offers scanning and managing software vulnerabilities to meet security requirements.
Azure Container Registry (ACR): Azure offers Microsoft Defender for Containers, which will scan images for vulnerabilities.
Google Cloud (GCP) Artifact Registry: it offers Container Analysis integration to provide vulnerability scanning and metadata storage for containers on Google Cloud.
Docker Hub: supports an automatic vulnerability scanning feature, which when enabled, automatically scans images when you push them to a Docker Hub repository. Requires a Docker subscription.
Tools
Some are from the Static Analysis section, these tools covers "Containers":
Snyk Container: Container and Kubernetes security that helps developers and DevOps find and fix vulnerabilities throughout the SDLC — before workloads hit production.
Docker Scout (included in Docker Desktop): a collection of software supply chain features that appear throughout Docker user interfaces and the command line interface (CLI). These features provide detailed insights into the composition and security of container images.
Qualys Container Security (CS): Qualys Container Security allows you to discover, track and continuously secure containers – from build to runtime. It provides deep visibility across on-premise container environments and managed containers across multiple cloud providers.
Aqua Security - Trivy: a comprehensive and versatile security scanner. Trivy has scanners that look for security issues, and targets where it can find those issues. One of these targets is container images.
For example you can use Inspec with the dev-sec/linux-baseline project to asses some Linux common issues:
Or the dev-sec/docker-baseline project:
Checkout the dev-sec page and GitHub for more.
Docker Bench for Security: a script that checks for dozens of common best-practices around deploying Docker containers in production.
Anchore grype: vulnerability scanner for container images and filesystems.
Haskell Dockerfile Linter: a smarter Dockerfile linter that helps you build best practice Docker images.
Dive (⚠️): not a scanner itself (but could help), it's a tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.
Dagda (⚠️): a tool to perform static analysis of known vulnerabilities, trojans, viruses, malware & other malicious threats in docker images/containers and to monitor the docker daemon and running docker containers for detecting anomalous activities.
Sources
[1]: How to Secure Your Docker Containers: Tips and Challenges - PurpleBox (prplbx.com)
[2]: What is container security? (redhat.com)
[3]: What is container security? | Container Security | Snyk
[4]: Docker Security Best Practices from the Dockerfile (cloudberry.engineering)
Last updated