OSV 1.4.0 · github-reviewed · 修改于 2026-06-09 18:25
发布时间
2026-05-15 00:24
GitHub 审查时间
2026-05-15 00:24
NVD 发布时间
2026-05-29 06:16
源文件
advisories/github-reviewed/2026/05/GHSA-mgq6-4x29-88r3/GHSA-mgq6-4x29-88r3.json
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.
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.
The missing return statement has been present since Kubernetes proxy support was introduced.
| Branch | First vulnerable | Fixed in |
|---|---|---|
| 2.33.x (LTS) | 2.33.0 | 2.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.
There is no configuration change that prevents the bypass directly. Administrators who cannot immediately upgrade can reduce exposure by:
kubeClientMiddlewareNeither of these replaces the fix.
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
}