Skip to content

oAuth2 Filter Signout route will not clear cookies because of missing "secure;" flag

Moderate
phlax published GHSA-95j4-hw7f-v2rh Sep 2, 2025

Package

Envoy

Affected versions

<=1.35

Patched versions

1.35.1, 1.34.5, 1.33.7, 1.32.10

Description

Summary

Insufficient Session Expiration in the Envoy OAuth2 filter leads to failed logout operations. When configured with __Secure- or __Host- prefixed cookie names, the filter fails to append the required Secure attribute to the Set-Cookie header during deletion. Modern browsers ignore this invalid request, causing the session cookie to persist. This allows a user to remain logged in after they believe they have logged out, creating a session hijacking risk on shared computers.

Details

Cookies with the __Secure- or __Host- prefix MUST be set with the Secure attribute. This requirement extends to cookie deletion, which is accomplished by setting an expired Set-Cookie header.

The current implementation iterates through the configured cookie names to generate deletion headers but does not check for these prefixes. As a result, when it attempts to delete a cookie named, for example, __Secure-id-token, it generates a header like:

Set-Cookie: __Secure-id-token=deleted; Expires=Thu, 01 Jan 1970 00:00:00 GMT

This is incorrect. The browser will reject this instruction because the Secure attribute is missing. The correct header should be:

Set-Cookie: __Secure-id-token=deleted; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure

This failure to properly construct the deletion header means the user's session cookies are never removed by the browser, leaving the session active.

PoC

  1. Has any of the following configs like:
- name: envoy.filters.http.oauth2
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.filters.http.oauth2.v3.OAuth2
    ...
    cookie_names:
      bearer_token: "__Secure-bearer"
      oauth_hmac: "__Secure-hmac"
      id_token: "__Secure-id-token"
      refresh_token: "__Secure-refresh-token"
    ...
  1. log-in
  2. log-out, the cookie will not be deleted

Impact

It impacts any environment using Envoy's OAuth2 filter where cookie names have been configured with __Secure- or __Host- prefixes. The primary risk is session hijacking in scenarios involving shared or public computers. A user who performs a logout action will be led to believe their session is terminated. However, the session remains active, allowing the next user of the same browser to gain unauthorized access to the original user's account and data.

Mitigation

  • Avoid the __Secure- or __Host- config
  • Apply the fix patch

Reporter:

Thomas Brüggemann [email protected]

Severity

Moderate

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
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None

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:L/UI:R/S:U/C:H/I:L/A:N

CVE ID

CVE-2025-55162

Weaknesses

Insufficient Session Expiration

According to WASC, Insufficient Session Expiration is when a web site permits an attacker to reuse old session credentials or session IDs for authorization. Learn more on MITRE.

Credits