CVE-2026-76835: OAuth2 Proxy 7.15.2 through 7.15.4 Authentication Bypass via X-Forwarded-Uri Under the Default Trusted Proxy Set
OAuth2 Proxy honours a client-supplied X-Forwarded-Uri header when deciding whether a request may skip authentication, because the guard added for CVE-2026-40575 is inert in the default reverse-proxy configuration. GetRequestURI in pkg/requests/util/util.go prefers that header over the real request URI whenever CanTrustForwardedHeaders returns true, and isAllowedPath in oauthproxy.go matches the skipauthroutes and skipauthregex allow list against the resulting path. CanTrustForwardedHeaders in pkg/apis/middleware/scope.go grants that trust when the caller's address is in the trusted proxy set, and buildTrustedProxyNetSet falls back to defaultTrustedProxyIPs, which is 0.0.0.0/0 and ::/0, whenever reverse proxy mode is enabled without trustedproxyip configured. Every client is therefore treated as a trusted proxy. An unauthenticated attacker can request a protected upstream path while setting X-Forwarded-Uri to a value matching an allow-listed route, so the skip-auth decision is made against the spoofed value while the upstream receives the protected path unchanged.
Other sources
OAuth2 Proxy is a reverse proxy that provides authentication using OAuth2 providers. Versions 7.5.0 through 7.15.1 may trust a client-supplied X-Forwarded-Uri header when --reverse-proxy is enabled and --skip-auth-regex or --skip-auth-route is configured. An attacker can spoof this header so OAuth2 Proxy evaluates authentication and skip-auth rules against a different path than the one actually sent to the upstream application. This can result in an unauthenticated remote attacker bypassing authentication and accessing protected routes without a valid session. Impacted users are deployments that run oauth2-proxy with --reverse-proxy enabled and configure at least one --skip-auth-regex or --skip-auth-route rule. This issue is patched in v7.15.2. Some workarounds are available for those who cannot upgrade immediately. Strip any client-provided X-Forwarded-Uri header at the reverse proxy or load balancer level; explicitly overwrite X-Forwarded-Uri with the actual request URI before forwarding requests to OAuth2 Proxy; restrict direct client access to OAuth2 Proxy so it can only be reached through a trusted reverse proxy; and/or remove or narrow --skip-auth-regex / --skip-auth-route rules where possible. For nginx-based deployments, ensure X-Forwarded-Uri is set by nginx and not passed through from the client.
— OSV
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in v7.15.2 - Configuration
Strip any client-provided X-Forwarded-Uri and overwrite it with the actual request URI before forwarding to OAuth2 Proxy; for nginx deployments, have nginx set this header rather than passing through the client value.
Reverse proxy or load balancer X-Forwarded-Uri = Actual request URI - Configuration
Remove or narrow --skip-auth-regex and --skip-auth-route rules where possible.
OAuth2 Proxy --skip-auth-regex / --skip-auth-route = Remove or narrow rules where possible - Compensating control
Restrict direct client access to OAuth2 Proxy so it can only be reached through a trusted reverse proxy.
Event History
Frequently Asked Questions
Which deployments are exposed by the default configuration?
Deployments running OAuth2 Proxy 7.15.2 through 7.15.4 are exposed when reverse proxy mode is enabled and trusted_proxy_ip is not configured. In that case, the default trusted proxy set includes 0.0.0.0/0 and ::/0, so any client is treated as a trusted proxy.
What does an attacker need to exploit this?
An unauthenticated network attacker only needs to send a request to OAuth2 Proxy with a client-supplied X-Forwarded-Uri value that matches a configured skip_auth_routes or skip_auth_regex allow-list entry. The attacker can request a protected upstream path while the spoofed header causes the authentication-skip decision.
What configuration change can reduce exposure if patching is not immediately possible?
Configure trusted_proxy_ip so that it contains only the actual reverse proxy addresses, rather than relying on the default trusted proxy set. This prevents arbitrary clients from being considered trusted for forwarded headers.
How can I determine whether my instance is vulnerable?
Check whether the instance is running version 7.15.2, 7.15.3, or 7.15.4, has reverse proxy mode enabled, lacks a trusted_proxy_ip configuration, and uses skip_auth_routes or skip_auth_regex. Under those conditions, a client-controlled X-Forwarded-Uri can influence the path used for the skip-auth check.