HighGHSA-m2qf-hxjv-5gpqCVE-2023-30861PYSEC-2023-62

Flask vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie header

Published 1 May 2023 · Updated 10 Sept 2026

Is your project on an affected flask?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected packages

flaskPyPI
Affected
>=2.3.0 <2.3.2
Fixed in
2.3.2
Update to the fixed version for your release line, for example:pip install 'flask>=2.3.2'
flaskPyPI
Affected
<2.2.5
Fixed in
2.2.5
Update to the fixed version for your release line, for example:pip install 'flask>=2.2.5'

Details

When all of the following conditions are met, a response containing data intended for one client may be cached and subsequently sent by a proxy to other clients. If the proxy also caches Set-Cookie headers, it may send one client's session cookie to other clients. The severity depends on the application's use of the session, and the proxy's behavior regarding cookies. The risk depends on _all_ these conditions being met.

1. The application must be hosted behind a caching proxy that does not strip cookies or ignore responses with cookies. 2. The application sets `session.permanent = True`. 2. The application does not access or modify the session at any point during a request. 4. `SESSION_REFRESH_EACH_REQUEST` is enabled (the default). 5. The application does not set a Cache-Control header to indicate that a page is private or should not be cached.

This happens because vulnerable versions of Flask only set the Vary: Cookie header when the session is accessed or modified, not when it is refreshed (re-sent to update the expiration) without being accessed or modified.

Is GHSA-m2qf-hxjv-5gpq in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected flask, and gives you the command that fixes it.

More advisories for flask

  • LowCVE-2026-27205Flask session does not add `Vary: Cookie` header when accessed in some ways · 19 Feb 2026
  • LowCVE-2025-47278Flask uses fallback key instead of current signing key · 13 May 2025
  • HighCVE-2019-1010083Pallets Project Flask is vulnerable to Denial of Service via Unexpected memory usage · 19 Jul 2019
  • HighCVE-2018-1000656Flask is vulnerable to Denial of Service via incorrect encoding of JSON data · 23 Aug 2018
flask security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.