CVE-2026-86863: pgAdmin 4: Authentication bypass via a client-controlled identity header in Webserver authentication mode
pgAdmin 4's Webserver authentication source is intended to accept an identity asserted by the web server or reverse proxy in front of pgAdmin, delivered through the WSGI/CGI environment. WebserverAuthentication.getuser() read config.WEBSERVERREMOTEUSER from request.environ and, when that returned nothing, fell back to reading the same name directly from the inbound HTTP request headers via request.headers.get(). An inbound HTTP header is written by whoever sends the request, so any client able to reach pgAdmin could supply that header itself and be authenticated as any username it named, including an existing Administrator, without presenting a password or any other credential. The environment lookup could also be satisfied by a client-supplied header whenever WEBSERVERREMOTEUSER was configured to an HTTP-prefixed or hyphenated name such as HTTPXFORWARDEDUSER or X-Forwarded-User, since WSGI servers place inbound headers into the environment under exactly those names. Deployments are affected only when 'webserver' is enabled in AUTHENTICATIONSOURCES.
The fix distinguishes a genuine CGI/WSGI variable from a header-derived one and implicitly trusts only the former. A header-asserted identity is now accepted only when the operator explicitly opts in via WEBSERVERREMOTEUSERFROMHEADER, the request arrives from a peer listed in WEBSERVERTRUSTEDPROXIES, and, when configured, a shared secret supplied in WEBSERVERSHAREDSECRETHEADER matches WEBSERVERSHAREDSECRET under a constant-time comparison. The trusted-peer check deliberately reads the real socket peer address rather than request.remoteaddr, because ProxyFix rewrites the latter from the client-controlled X-Forwarded-For header and would otherwise allow an attacker to claim to be the trusted proxy. As defence in depth, login() now refuses any account whose authsource is not 'webserver', so a misconfigured trust gate cannot be used to assume an internal or LDAP account.
This issue affects pgAdmin 4: from 6.2 before 9.18.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pgAdmin 4to a version that resolves this vulnerability.Fixed in 9.18 - Configuration
Ensure 'webserver' is not enabled in AUTHENTICATION_SOURCES unless you need Webserver authentication. Deployments are affected only when 'webserver' is enabled.
pgAdmin 4 (webserver authentication) AUTHENTICATION_SOURCES (enable webserver source) = webserver (disabled unless explicitly required) - Configuration
Require explicit opt-in by setting WEBSERVER_REMOTE_USER_FROM_HEADER so that a header-asserted identity is accepted only when you explicitly enable it.
pgAdmin 4 (webserver authentication) WEBSERVER_REMOTE_USER_FROM_HEADER = enable/opt-in explicitly only when using Webserver authentication - Configuration
Configure WEBSERVER_TRUSTED_PROXIES to include only the real peer addresses of the reverse proxies that are allowed to assert the user identity header.
pgAdmin 4 (webserver authentication) WEBSERVER_TRUSTED_PROXIES = configure to trusted peer(s) only - Configuration
When configured, ensure the shared secret supplied in WEBSERVER_SHARED_SECRET_HEADER matches WEBSERVER_SHARED_SECRET (the fix uses constant-time comparison).
pgAdmin 4 (webserver authentication) WEBSERVER_SHARED_SECRET_HEADER = set and configure a matching WEBSERVER_SHARED_SECRET for constant-time comparison
Event History
Frequently Asked Questions
Which deployments are exposed?
Only deployments with 'webserver' enabled in AUTHENTICATION_SOURCES are affected. Any client that can reach the pgAdmin instance may be able to exploit the issue if the configured identity variable can be controlled through an inbound request header.
What does an attacker need to exploit this?
The attacker needs network access to pgAdmin and does not need a password or other credential. They can send the configured identity header themselves and name an arbitrary username, including an existing Administrator.
Are reverse-proxy identity-header configurations affected?
Yes. Configurations using HTTP_-prefixed or hyphenated names, such as HTTP_X_FORWARDED_USER or X-Forwarded-User, are vulnerable because WSGI servers place inbound headers into the environment under those names.
How can I assess whether my instance is at risk?
Check whether AUTHENTICATION_SOURCES includes 'webserver', then identify the value configured for WEBSERVER_REMOTE_USER. If it is an HTTP_-prefixed or hyphenated header-style name, or if requests can reach pgAdmin with that identity header client-controlled, the deployment is at risk.