CVE-2026-44882
JSON

8.1high

Portainer: Kubernetes middleware continues after token validation failure, bypassing endpoint authorization

Severity
8.1high CVSS:3.1 by GitHub_M
Exploit likelihood
0.48% (higher than 34% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-mgq6-4x29-88r3GO-2026-5505

Description

Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments. From 2.33.0 to before 2.33., Portainer proxies requests to Kubernetes clusters through a middleware layer (kubeClientMiddleware) that validates the requesting user's token before forwarding traffic to the cluster. When security.RetrieveTokenData returned an error, the middleware wrote an HTTP 403 response but was missing a return statement — execution continued into the handler with a nil tokenData value. The Kubernetes endpoints sit behind Portainer's outer AuthenticatedAccess bouncer, so an attacker requires a valid Portainer session. However, a user whose secondary token validation fails in kubeClientMiddleware — for example a user without permission to access a given Kubernetes endpoint — would have their request forwarded to the cluster anyway, bypassing the authorization check. The same defect was present in both the CE and EE codebases. This vulnerability is fixed in 2.33.8.

Affected

Product or packageVersionsReported by
portainer portainer>= 2.33.0, < 2.33.8, from 2.33.0 before 2.33.8CVE List, NVD
github.com/portainer/portainer (Go)from 2.33.0 before 2.33.8, all versionsGitHub Advisory Database, Go Vulnerability Database

All scores

GitHub_M8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
GitHub8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Classification

CWE-863

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments. From 2.33.0 to before 2.33., Portainer proxies requests to Kubernetes clusters through a middleware layer (kubeClientMiddleware) that validates the requesting user's token before forwarding traffic to the cluster. When security.RetrieveTokenData returned an error, the middleware wrote an HTTP 403 response but was missing a return statement — execution continued into the handler with a nil tokenData value. The Kubernetes endpoints sit behind Portainer's outer AuthenticatedAccess bouncer, so an attacker requires a valid Portainer session. However, a user whose secondary token validation fails in kubeClientMiddleware — for example a user without permission to access a given Kubernetes endpoint — would have their request forwarded to the cluster anyway, bypassing the authorization check. The same defect was present in both the CE and EE codebases. This vulnerability is fixed in 2.33.8.

GitHub Advisory Database

Summary

Portainer proxies requests to Kubernetes clusters through a middleware layer (kubeClientMiddleware) that validates the requesting user's token before forwarding traffic to the cluster. When security.RetrieveTokenData returned an error, the middleware wrote an HTTP 403 response but was missing a return statement — execution continued into the handler with a nil tokenData value.

The Kubernetes endpoints sit behind Portainer's outer AuthenticatedAccess bouncer, so an attacker requires a valid Portainer session. However, a user whose secondary token validation fails in kubeClientMiddleware — for example a user without permission to access a given Kubernetes endpoint — would have their request forwarded to the cluster anyway, bypassing the authorization check. The same defect was present in both the CE and EE codebases.

Severity

High CWE-863 — Incorrect Authorization

Privilege required is Low — any valid Portainer session is sufficient to reach the middleware. Once the authorization outcome is bypassed, the attacker can read and modify Kubernetes resources on the target endpoint that their role should not permit — confidentiality and integrity impact are both High. No availability impact is introduced directly.

Affected Versions

The missing return statement has been present since Kubernetes proxy support was introduced.

BranchFirst vulnerableFixed in
2.33.x (LTS)2.33.02.33.8

Portainer 2.39.0 and later are not affected — the fix was present from the initial 2.39.0 release. All releases prior to 2.33.0 are end-of-life and will not receive a fix; users on EOL versions should upgrade to a supported release.

Workarounds

There is no configuration change that prevents the bypass directly. Administrators who cannot immediately upgrade can reduce exposure by:

  • Restricting Kubernetes endpoint access. Remove Portainer access to Kubernetes endpoints for users who do not require it. A user without endpoint access cannot reach kubeClientMiddleware.
  • Auditing Kubernetes RBAC. Ensure the service account Portainer uses to proxy cluster requests carries least-privilege RBAC permissions — this limits the blast radius if the bypass is exploited.

Neither of these replaces the fix.

Affected Code

kubeClientMiddleware in api/http/handler/kubernetes/handler.go wrote the error response but did not return, allowing execution to continue with nil tokenData:

// api/http/handler/kubernetes/handler.go (pre-fix — CE and EE)
tokenData, err := security.RetrieveTokenData(r)
if err != nil {
    httperror.WriteError(w, http.StatusForbidden,
        "permission denied to access the environment", err)
    // missing return — tokenData is nil, execution continues
}

// tokenData.ID dereferenced on the next line:
_, ok := handler.KubernetesClientFactory.GetProxyKubeClient(
    strconv.Itoa(endpointID), strconv.Itoa(int(tokenData.ID)))

The fix adds a single return after the WriteError call in both CE and EE:

// post-fix
if err != nil {
    httperror.WriteError(w, http.StatusForbidden,
        "permission denied to access the environment", err)
    return
}

Impact

  • Kubernetes authorization bypass. A low-privileged Portainer user can reach Kubernetes API endpoints on environments their role does not permit, with the proxy client of the legitimate session used as the vehicle.
  • Cluster resource access. Depending on the service account permissions Portainer holds on the cluster, the attacker can read or modify namespaced resources — including pods, secrets, config maps, and deployments.
  • Potential for lateral movement. Kubernetes secrets readable through this path may contain credentials for other services within the cluster or the broader infrastructure.

Timeline

  • 2026-02-16: Fix merged to develop.
  • 2026-02-25: 2.39.0 released with fix.
  • 2026-05-07: 2.33.8 released with backport fix.
Go Vulnerability Database

Portainer's Kubernetes middleware continues after token validation failure, bypassing endpoint authorization in github.com/portainer/portainer.

NOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.

(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)

The additional affected modules and versions are: github.com/portainer/portainer from v2.33.0 before v2.33.8.

NVD (es)

Portainer Community Edition es una plataforma ligera de entrega de servicios para aplicaciones en contenedores que puede utilizarse para gestionar entornos Docker, Swarm, Kubernetes y ACI. Desde la 2.33.0 hasta antes de la 2.33., Portainer actúa como proxy para las solicitudes a los clústeres de Kubernetes a través de una capa de middleware (kubeClientMiddleware) que valida el token del usuario solicitante antes de reenviar el tráfico al clúster. Cuando security.RetrieveTokenData devolvía un error, el middleware escribía una respuesta HTTP 403 pero faltaba una sentencia de retorno — la ejecución continuaba en el gestor con un valor tokenData nulo. Los puntos finales de Kubernetes se encuentran detrás del bouncer externo AuthenticatedAccess de Portainer, por lo que un atacante requiere una sesión válida de Portainer. Sin embargo, un usuario cuya validación de token secundaria falla en kubeClientMiddleware — por ejemplo, un usuario sin permiso para acceder a un punto final de Kubernetes determinado — vería su solicitud reenviada al clúster de todos modos, omitiendo la comprobación de autorización. El mismo defecto estaba presente tanto en las bases de código CE como EE. Esta vulnerabilidad está corregida en la 2.33.8.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-44882 changed 2026-05-30CVE Terms of Use
GitHub Advisory DatabaseGHSA-mgq6-4x29-88r3 changed 2026-06-25CC-BY-4.0
Go Vulnerability DatabaseGO-2026-5505 changed 2026-06-25CC-BY-4.0
NVDCVE-2026-44882 changed 2026-07-21Public domain