Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

Leaked container IDs can cross Portainer user boundaries

Leaked container IDs can cross Portainer user boundaries Portainer users often share a container environment while working on different applications. That model assumes the management layer enforces ownership on every

Leaked container IDs can cross Portainer user boundaries

Portainer users often share a container environment while working on different applications. That model assumes the management layer enforces ownership on every object. CVE-2026-134804 is a case where the WebSocket attach and exec endpoints did not preserve that boundary for Standard users. The flaw affects Portainer 2.39.0 through releases before 2.39.9, 2.40.0 through releases before 2.45.4, and 3.0.0 through releases before 3.1.0.

The authorization gap

The public advisory says a Standard user with access to a shared environment could use a leaked container or exec ID against /api/websocket/attach or /api/websocket/exec. The result could be an interactive session in another user's container, including a root shell where the container permits it. The CVSS 3.1 score is 8.8 and the weakness is mapped to CWE-639, authorization bypass through user-controlled key.

This is not a generic container escape finding. The attacker needs a Portainer account, access to an environment where the target exists, and an identifier that identifies the container or exec session. The sources do not claim that every Standard user automatically knows those IDs. They do say the identifier check was not sufficient to prevent an authorized low-privilege user from reaching a resource outside their intended scope.

Why shared environments are exposed

Container management tools sit above Docker or Kubernetes and often hold more authority than an ordinary application dashboard. A Portainer session can reach container logs, environment variables, mounted data and process consoles. If one team can enter another team's container, the boundary between two projects may disappear even though both projects live on the same host.

The practical risk grows when container IDs appear in support tickets, browser histories, monitoring records, CI output or copied URLs. Those values may look like opaque identifiers, but this advisory shows why they must be treated as capability-like references during an investigation. The vulnerable endpoints still require authentication, so an unauthenticated internet scan does not by itself prove exploitation.

Remediation and verification

The fixed releases are Portainer 2.39.9, 2.45.4 and 3.1.0 for their respective branches. Administrators should inventory the running version before relying on package labels, then update through the supported deployment path and verify that the management interface returns the expected new version.

After the update, review who can reach each Portainer environment. Standard users should not receive broad environment access unless their work requires it. Teams that do not need container consoles should have that capability restricted by product policy and network controls. Internet exposure of the management interface should be an explicit exception with strong authentication, not a default deployment choice.

Portainer and reverse-proxy logs should be checked for WebSocket requests to attach or exec endpoints made by low-privilege accounts. Useful context includes the source address, authenticated user, target environment, container or exec identifier, and whether the session followed an unusual support request. These are investigation leads. The advisory does not provide a log signature that proves an attack.

If a session looks unauthorized, preserve its logs and stop the container only after the evidence is captured when that is operationally possible. Review image provenance, mounted secrets, environment variables and data accessed from the container. Rotate credentials that were visible inside it, including cloud roles, database passwords, registry tokens and deployment keys. Remove stale users and environment assignments that were not needed before the incident.

A tighter control model

Portainer access should follow the same rule as production shell access: named users, small groups, time-bounded exceptions and a reviewable path to the target. Shared service accounts make attribution weak. Broad Standard-user membership makes an identifier leak more damaging. Environment separation at the Portainer layer is useful only when the identity provider, reverse proxy and network policy enforce the same separation.

The fix closes the reported WebSocket authorization gap. It does not make a management console safe to publish to the internet without an access review.

References

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.