Skip to main content

Impact & Risk Analysis

  • Severity: Medium
  • CIS Benchmark: CIS 5.11
  • Impact: Denial of Service (DoS). By default, a single container can consume all available memory on the host. If a container has a memory leak or is compromised to run a resource-heavy process (like a cryptominer), it can starve other containers or crash the host system entirely, rendering the service unusable.

Common Misconfiguration

Running containers without defining resource limits. By default, all containers on a Docker host share resources equally and no memory limits are enforced, meaning a container can use unlimited RAM.

Vulnerable Example

Secure Example

Audit Procedure

Run the command below to inspect the memory limits of all containers:
  • Result: This returns the memory limit in bytes.
  • Fail: If it returns 0, it means no memory limits are in place.
  • Pass: If it returns a non-zero value (e.g., 268435456 for 256MB), limits are enforced.

Remediation

You should run the container with only as much memory as it requires using the --memory argument or the mem_limit / deploy.resources configuration in Docker Compose. For example, to limit a container to 256 MB: