/

CVE-2026-134804

Severity:

HIGH RISK

(8.8)

Authorization Bypass (CWE-639) in Portainer WebSocket

CVE-2026-134804

Received

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-639

Impact:

Unauthorized container access and potential interactive shell access

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Portainer's WebSocket attach and exec endpoints may allow Standard users to access containers belonging to other users in a shared environment. If a user can obtain another session's container or exec ID, they may hijack that session and gain interactive access, potentially including a root shell.

Affected context

The issue concerns Portainer's WebSocket attach and exec endpoints in shared environments. It may arise when the application accepts a container or exec identifier without adequately verifying that the requesting user is authorized to access the associated resource. The described affected releases are Portainer 2.39.0 before 2.39.9, 2.40.0 before 2.45.4, and 3.0.0 before 3.1.0.

Exploit preconditions

  • Attack surface: Portainer WebSocket endpoints at /api/websocket/attach and /api/websocket/exec
  • Required access: A Standard user account with access to a shared environment
  • Trigger point: A WebSocket attach or exec request referencing another user's container or exec session
  • Why exploitation is possible: Authorization may not be correctly checked against the requested resource and the user's permissions; access to a relevant ID can enable session hijacking

Why this happens

The vulnerability is an object-level authorization failure associated with CWE-639: Authorization Bypass Through User-Controlled Key. The insecure pattern is allowing a client-supplied identifier to select a container or exec session without verifying, for each request, that the authenticated user is permitted to access that specific resource. Identifier secrecy alone is not an authorization control.

Potential impact

  • A Standard user may access containers assigned to other users
  • An attacker could hijack an attach or exec session
  • Unauthorized interactive command execution may occur within a container
  • If the container runs with elevated privileges, compromise could have broader effects on the host or environment

General mitigation guidance

Defensive patterns focus on enforcing resource-level authorization at every attach and exec operation.

  • Derive the user's permitted resources from trusted server-side identity and policy data
  • Check ownership and environment permissions for each requested container or exec session
  • Avoid treating possession or unpredictability of an identifier as proof of authorization
  • Apply least privilege to users, containers, and service accounts
  • Limit WebSocket access to the operations and resources each role requires

How teams detect issues like this

  • Review WebSocket handlers for authorization checks tied to the specific requested container and exec session
  • Use static analysis or code review rules to flag client-controlled identifiers used in resource lookups without permission checks
  • Audit access logs for users attaching to or executing in resources outside their expected scope
  • Enforce policy tests covering cross-user and cross-environment access attempts
  • Consider automated security review tools as an aid for identifying missing object-level authorization

Sources

SourceLink
github.comgithub.com/portainer/portainer/blob/2.45.3/api/http/handler/websocket/attach.go#L42-L92
github.comgithub.com/portainer/portainer/blob/2.45.3/api/http/handler/websocket/exec.go#L45-L96
github.comgithub.com/portainer/portainer/commit/52f82e7c7eec08fa4b421cd423798b8966e13857
github.comgithub.com/portainer/portainer/commit/d817b8762b8144ff5de2bf8d3201578d3d9d106f
github.comgithub.com/portainer/portainer/releases/tag/2.45.4
github.comgithub.com/portainer/portainer/security/advisories/GHSA-6c57-xm2f-23fg
vulncheck.comvulncheck.com/advisories/portainer-2.39.0-before-2.39.9-2.40.0-before-2.45.4-and-3.0.0-before-3.1.0-authorization-bypass-via-websocket-attach-and-exec

Frequently asked

questions

The described scenario involves a Standard user who can access a shared Portainer environment and obtain a relevant container or exec ID.

Yes. The vulnerability description requires shared environment access; the required role and deployment permissions affect the practical scope.

Perform server-side, resource-level authorization checks for every WebSocket attach and exec request. Do not rely on identifiers being difficult to guess or obtain.

Test authorization across users and environments, review identifier-based resource lookups, and apply least privilege to users and workloads.

Find out what's already
exploitable in your codebase.