CVE-2025-49593 Overview
Portainer Community Edition is a service delivery platform for managing Docker, Swarm, Kubernetes, and Azure Container Instances (ACI) environments. CVE-2025-49593 is an information disclosure vulnerability [CWE-200] in Portainer's reverse proxy component. When an administrator registers a malicious container registry, or when an attacker takes over an existing registry, Portainer forwards HTTP headers to that registry without filtering. Those headers may include registry authentication credentials and Portainer session tokens. The issue affects Portainer STS versions prior to 2.31.0 and LTS versions prior to 2.27.7.
Critical Impact
An attacker-controlled container registry can capture forwarded Portainer session tokens and registry credentials, enabling account takeover and pivoting into managed container environments.
Affected Products
- Portainer Community Edition STS prior to 2.31.0
- Portainer Community Edition LTS prior to 2.27.7
- Portainer deployments managing Docker, Swarm, Kubernetes, and ACI environments
Discovery Timeline
- 2025-06-17 - CVE-2025-49593 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-49593
Vulnerability Analysis
The vulnerability lives in Portainer's reverse proxy factory at api/http/proxy/factory/reverse_proxy.go. The proxy relayed all inbound HTTP headers from the Portainer client to the upstream container registry. Sensitive headers such as X-Registry-Auth, session tokens, and cookies were forwarded verbatim.
A Portainer administrator who is tricked into registering an attacker-controlled registry sends authenticated requests through the proxy. The malicious registry endpoint receives those headers and can extract credentials or replay session tokens against the Portainer API. Header leakage also occurs if an existing trusted registry is compromised or hijacked via DNS or supply-chain manipulation.
Root Cause
The reverse proxy director function did not enforce a header allow-list before forwarding requests upstream. Any header present on the inbound request was passed through to the registry, violating the principle of minimal disclosure to third-party services.
Attack Vector
Exploitation requires administrator interaction. An attacker must convince a Portainer administrator to add a malicious registry URL, or must compromise an already-configured registry. Once traffic flows through the proxy, headers are captured server-side by the attacker.
// Patch: whitelist headers for proxy to forward [BE-11819]
// Source: https://github.com/portainer/portainer/commit/384cb53c64af78af8e1ac7ef5b0f91bad530e989
// Note that we discard any non-canonical headers by design
var allowedHeaders = map[string]struct{}{
"Accept": {},
"Accept-Encoding": {},
"Accept-Language": {},
"Cache-Control": {},
"Content-Length": {},
"Content-Type": {},
"Private-Token": {},
"User-Agent": {},
"X-Portaineragent-Target": {},
"X-Portainer-Volumename": {},
"X-Registry-Auth": {},
}
// newSingleHostReverseProxyWithHostHeader is based on NewSingleHostReverseProxy
// from golang.org/src/net/http/httputil/reverseproxy.go and merely sets the Host
// HTTP header, which NewSingleHostReverseProxy deliberately preserves.
func newSingleHostReverseProxyWithHostHeader(target *url.URL) *httputil.ReverseProxy {
return &httputil.ReverseProxy{Director: createDirector(target)}
}
The patch introduces an allowedHeaders allow-list inside createDirector. Headers absent from this map are dropped before the request leaves Portainer, preventing session tokens and unrelated authentication headers from reaching untrusted registries. See the Portainer commit 384cb53 and the LTS backport b767dcb.
Detection Methods for CVE-2025-49593
Indicators of Compromise
- Container registry entries in Portainer pointing to unfamiliar or recently added hostnames.
- Outbound HTTPS traffic from the Portainer server carrying Cookie or session headers to registry hostnames.
- Registry access logs (where controlled) containing headers not required for the Docker Registry v2 API.
Detection Strategies
- Audit the Portainer registry configuration and compare against an approved allow-list of registry endpoints.
- Inspect Portainer server egress traffic for HTTP headers other than the sanctioned allow-list when communicating with registries.
- Correlate administrator sessions with registry add or update events to identify social-engineering attempts.
Monitoring Recommendations
- Enable authenticated egress proxying so Portainer-to-registry traffic can be inspected for anomalous header content.
- Alert on new registry entries created outside a change-management window.
- Rotate Portainer session tokens and registry credentials on any suspicion of exposure.
How to Mitigate CVE-2025-49593
Immediate Actions Required
- Upgrade Portainer STS to 2.31.0 or later, or LTS to 2.27.7 or later.
- Review all configured registries and remove any that are not explicitly trusted.
- Rotate registry credentials and invalidate active Portainer sessions after upgrade.
Patch Information
The fix is delivered in Portainer STS 2.31.0 and LTS 2.27.7. Both branches introduce an outbound header allow-list in the reverse proxy director. Refer to GitHub Security Advisory GHSA-h5jw-8c32-xfv6 for vendor guidance.
Workarounds
- Restrict registry registration to a hardened administrator workflow that requires multi-party approval.
- Route Portainer registry traffic through an egress proxy that strips unauthorized headers.
- Limit Portainer administrator accounts and enforce multi-factor authentication to reduce social-engineering risk.
# Verify installed Portainer version and upgrade via Docker
docker inspect portainer/portainer-ce:latest --format '{{.Config.Labels.version}}'
# Pull fixed STS image
docker pull portainer/portainer-ce:2.31.0
# Or pull fixed LTS image
docker pull portainer/portainer-ee:2.27.7
# Redeploy the container with the patched image
docker stop portainer && docker rm portainer
docker run -d -p 9443:9443 --name portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.31.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

