Users in the docker Group
Accounts in the docker group can control the Docker daemon, which runs as root, and so can gain full root access to the host without a password.
| Severity | High |
| CVSS 3.1 | 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 8.5 CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-266: Incorrect Privilege Assignment |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1610 Deploy Container, T1611 Escape to Host |
| Category | Broken Access Control |
Description
On Linux, the Docker daemon (dockerd) normally runs as root and takes commands through the Unix socket /var/run/docker.sock, which is owned by root and the docker group. Adding a user to the docker group, which Docker's installation guidance offers as a way to run Docker commands without sudo, gives that user full control of the daemon. Docker's own documentation states that only trusted users should be allowed to control the daemon, and that the docker group grants root-level privileges.
Control of the daemon amounts to control of the host, because a member can start a container that mounts the host's root file system, runs in privileged mode or shares the host's process and network namespaces, and then change any file on the host from inside it. Any member of the group, or an attacker who compromises a member's account or a process running as it, can therefore become root on the host with a single command, without a password and without exploiting any vulnerability, for example by running a container that mounts the host's / directory. From there they have full control of the host and its data, and of every container on it, including the secrets and credentials those containers hold. The same applies to any account or service that can write to the Docker socket, and to the equivalent sockets of other container engines running as root, such as rootful Podman's API socket or containerd's socket.
Group membership is easy to overlook in access reviews, because it does not appear among the host's administrative accounts or sudo rules. The weakness is identified by listing the group's members (getent group docker) and checking the socket's permissions; it is often found on build servers, developer machines and hosts where an application or monitoring agent was given access to Docker. A socket mounted into a container, and a daemon API exposed over the network, are reported separately.
Remediation
Treat membership of the docker group as equivalent to root, and limit it accordingly:
- Remove every account that does not need to administer Docker from the group (for example with
gpasswd -d), and keep the remaining members to administrators who would be trusted with root. - Where users need to run containers without administering the host, use Docker in rootless mode or rootless Podman, so that the daemon and containers run under the user's own account rather than as root.
- Do not give applications, monitoring agents or CI runners access to the Docker socket unless they are trusted with root; where they need only some information, put a proxy in front of the socket that allows only the API calls they need.
- Keep the socket owned by root and the
dockergroup with mode660, and monitor changes to the group's membership and the use of privileged containers and host mounts, for example with audit rules on the socket and the Docker binaries. - Where finer control is needed over which Docker API requests a user may make, use an authorisation plugin for the daemon.
Confirm the fix with getent group docker, and by checking as a former member that Docker commands are refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.