Read the docs

NULL pointer dereference in Envoy api_key_auth filter crashes the process

Priority MEDIUM 44CWE-476Published · Updated

Key facts

Attack vector
Network
Privileges required
Low
User interaction
None
Attack complexity
Low
Impact type
Denial of service
Confidentiality · integrity · availability
None · None · High
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-47vj-9r25-wv5j. Fix status from GitHub. Impact type from CWE-476.

Summary

Envoy's api_key_auth HTTP filter dereferences the :path pseudo-header without a null check when hiding credentials. A client with a valid API key can crash the Envoy process with a single CONNECT request that carries no :path, if the filter has a query key source alongside another key source and forwarding.hide_credentials is true. The crash is a NULL pointer dereference (CWE-476) and takes down the whole process, since all workers run in one process.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

Description from the GitHub advisory

## Brief description The `api_key_auth` HTTP filter (`envoy.filters.http.api_key_auth`) dereferences the `:path` pseudo-header without a null check when stripping a `query` key source from the request. A classic HTTP `CONNECT` request legitimately carries no `:path`, and Envoy explicitly permits that. A client holding a valid API key can crash the Envoy process with a single request when the filter is configured with `forwarding.hide_credentials: true` and a `query` key source alongside another key source. ## Affected component - `envoy.filters.http.api_key_auth` — `security_posture: robust_to_untrusted_downstream`, `status: alpha`. - Sink: `KeySources::Source::removeKey` in `source/extensions/filters/http/api_key_auth/api_key_auth.cc`, reached from the unconditional loop in `KeySources::removeKey`. ## Attack vector A client holding a valid API key sends a path-less `CONNECT` with the key in a header-backed key source, against a filter configured with at least two key sources (one of them `query`) and `forwarding.hide_credentials: true`. Authentication succeeds, credential stripping then walks *every* configured source, and the `query` source dereferences the absent `:path`. Envoy runs all workers in a single process, so the crash drops every connection the instance was serving and can be replayed indefinitely. ## Example exploit or proof-of-concept ```yaml - name: envoy.filters.http.api_key_auth typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.api_key_auth.v3.ApiKeyAuth key_sources: - header: "x-api-key" - query: "api_key" forwarding: hide_credentials: true credentials: - key: "supersecret" client: "acme" ``` with an ordinary route table (`match: { prefix: "/" }`, no `connect_matcher`). Trigger, with a valid key: ``` printf 'CONNECT anything:443 HTTP/1.1\r\nHost: anything:443\r\nx-api-key: supersecret\r\n\r\n' \ | nc <envoy-host> 10000 ``` Result: SIGSEGV in `KeySources::Source::removeKey`. ## Details ### Why `:path` can be absent `HeaderUtility::checkRequiredRequestHeaders` requires `:path` only in the non-CONNECT branch; for CONNECT it requires only `Host`. The HTTP/1 server codec does not set `:path` for an authority-form CONNECT target, and an HTTP/2 `CONNECT` with `:authority` and no `:path`/`:scheme`/`:protocol` reaches the same state. ### Why the filter chain runs at all The connection manager's "route does not permit upgrades" 403 is only evaluated when a route has matched. For a path-less request no route matches unless a `connect_matcher` route is configured, because `RouteMatcher::route` skips every candidate whose `supportsPathlessHeaders()` is false and only `ConnectRouteEntryImpl` overrides that to true. So under any ordinary prefix/path/safe_regex route table the request falls through directly to the filter chain. Omitting CONNECT support from the route table is the vulnerable configuration, not a mitigation. ### The defect `KeySources::removeKey` iterates **every** configured source, regardless of which one actually produced the validated key: ```cpp void KeySources::removeKey(Http::RequestHeaderMap& headers) const { for (const auto& source : key_sources_) { source.removeKey(headers); } } ``` and the `query` branch of `KeySources::Source::removeKey` ends with: ```cpp headers.setPath(params.replaceQueryString(headers.Path()->value())); // null deref ``` The *lookup* path is already null-safe — `KeySources::Source::getKey` reads the path through `headers.getPathValue()`, which returns an empty view when `:path` is absent. Only the *removal* path dereferences the pointer. That asymmetry is why the bug survives normal testing: the query source correctly finds nothing, a header source supplies the key, authentication succeeds, and the crash happens afterwards during credential stripping. ## Fix The `query` branch of `KeySources::Source::removeKey` now returns early when `:path` is absent, so credential stripping skips query-string rewriting for path-less requests. A regression test covering a path-less `CONNECT` has been added. ## Affected versions All versions since the filter was introduced in 1.33.0. ## Fixed versions 1.36.12, 1.37.8, 1.38.6, 1.39.3 ## Mitigations Insert an RBAC filter *before* `api_key_auth` in `http_filters`, denying `:method: CONNECT`: ```yaml - name: envoy.filters.http.rbac typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC rules: action: DENY policies: deny-connect: permissions: - header: { name: ":method", string_match: { exact: "CONNECT" } } principals: - any: true ``` This is safe on path-less requests: the header matcher reads `:method`, which is always present, and RBAC's own path matcher explicitly handles a null `:path`. Alternatively, either drop the `query` key source or set `forwarding.hide_credentials: false`. Either alone prevents the sink from being reached. **Not a mitigation:** omitting CONNECT from `upgrade_configs`. As shown above, that is the vulnerable configuration. ## Detection The process dies while handling the request, so the offending request generally does not reach the access log. Look for: 1. **Fatal-error backtrace** with frames through `Envoy::Extensions::HttpFilters::ApiKeyAuth::KeySources::Source::removeKey`. 2. **Repeated process restarts** on listeners running the filter, especially at a steady interval, indicating a replayed request. 3. **Upstream of the proxy**, in CDN or load-balancer logs: authority-form `CONNECT` requests with no path, immediately followed by a connection reset. 4. **On patched builds**, an access log format including `%REQ(:METHOD)%` and `%REQ(:PATH)%` will show `CONNECT` with an empty path reaching these listeners — each such entry would have crashed a vulnerable build. ## Credits threatroute66 ## References * Related: CVE-2026-73547 (`ext_authz`, same defect class — the `ext_authz` portion of the original report was addressed under that advisory) * Related: <oauth2 CVE / GHSA-8vc2-jrm4-835w> (`oauth2`, same defect class) * Introducing commit: `d2dbc0539b` — "auth: new api auth implementation (#36968)", 2024-12-11 * Threat model: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model

Why it matters now

Fix Fixed Envoy (envoy proxy): 1.36.12 1.37.8 1.38.6 1.39.3

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—Envoy (envoy proxy)>= 1.33.01.36.12 1.37.8 1.38.6 1.39.3Patch availableGHSA-47vj-9r25-wv5j
  • Envoy (envoy proxy) Vendor— Affected >= 1.33.0 Fixed in 1.36.12 1.37.8 1.38.6 1.39.3 Patch available GHSA-47vj-9r25-wv5j

Remediation

Upgrade Envoy to version 1.36.12, 1.37.8, 1.38.6 or 1.39.3, which fix the flaw. The sources list no fixed version for Envoy releases before 1.33.0 that are not listed here.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

  • Fix · GHSA-47vj-9r25-wv5j Envoy (envoy proxy) Fixed in 1.36.12 1.37.8 1.38.6 1.39.3 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-47vj-9r25-wv5j

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences