Portainer Community Edition
Portainer fails to properly enforce `EndpointSecuritySettings` restrictions on the Docker Swarm service API, allowing non-admin users with Swarm endpoint access to bypass security policies. While restrictions on privileged mode, host PID namespace, device mapping, capabilities, sysctls, security-opt (Seccomp / AppArmor), and bind mounts are enforced during standard container creation, they are not consistently applied to Swarm services.
Technical details include:
- The 'POST /services/create' endpoint only applies one of seven checks, failing to validate `CapabilityAdd`, `CapabilityDrop`, `Sysctls`, and `Privileges` (Seccomp / AppArmor) in the request body.
- The 'POST /services/{id}/update' endpoint applies zero checks, as it does not inspect the request body or call the `fetchEndpointSecuritySettings()` function.
- The 'POST /volumes/create' endpoint lacks any `AllowBindMountsForRegularUsers` checks.
- A bypass exists where a mount with `Type: "volume"` and `VolumeOptions.DriverConfig.Options` containing `type: "none", o: "bind"` is treated as a bind mount by the Docker daemon, bypassing restrictions.
An attacker can use these flaws to gain elevated Linux capabilities (e.g., `CAP SYS ADMIN`), disable syscall filtering or AppArmor, and create bind mounts of host paths (such as `/`), potentially achieving root access on the Swarm manager host.