---
title: "HOST-CTR-013 Containers Run as Root With a Writable Root Filesystem"
canonical: https://openvapt.com/checks/HOST-CTR-013.html
html: https://openvapt.com/checks/HOST-CTR-013.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# HOST-CTR-013 Containers Run as Root With a Writable Root Filesystem

Looks for containers whose process runs as root and whose root filesystem is writable.

- Domain: Server
- Severity: Medium
- Control category: Secure Configuration
- Fix effort: medium
- CVSS v3.1 vector: `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L`
- CIS Controls v8: 4.1
- NIST CSF 2.0: PR.PS-01
- CWE: CWE-250, CWE-732
- NIST SP 800-53 Rev. 5: AC-6, CM-7
- Benchmark topic: CIS Docker Benchmark 4.1 and 5.13 (non-root user; read-only root filesystem) (topic only, no benchmark text)

## Why It Matters

Root inside the container is the first half of most container escapes, and a writable root filesystem lets an attacker install tools and persist. A non-root user plus --read-only with a few tmpfs mounts removes both at once for most services.

## How It Detects

Reads Config.User from config.v2.json and ReadonlyRootfs from hostconfig.json (needs root) and fails when the user is empty, root or 0 and the root filesystem is writable.

## How to Fix

Add USER <uid> to the image or run with --user 1000:1000, and start the container with --read-only plus --tmpfs /tmp for scratch space; recreate the container.

## How to Verify

```
docker inspect --format '{{.Name}} user={{.Config.User}} ro={{.HostConfig.ReadonlyRootfs}}' $(docker ps -aq)
```

## Learn the Theory

- [P9 Containers and Kubernetes](https://openvapt.com/academy/p9.md)
- [A5 Container Runtime Hardening Depth](https://openvapt.com/academy/a5.md)

## References

- [OWASP Docker Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html)
- [NIST SP 800-190, Application Container Security Guide](https://csrc.nist.gov/pubs/sp/800/190/final)
- [CIS Docker Benchmark (referenced by recommendation number)](https://www.cisecurity.org/benchmark/docker)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/host/containers_depth.go

Run it: `openvapt scan --only HOST-CTR-013`. Read it offline: `openvapt explain HOST-CTR-013`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/HOST-CTR-013.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
