CVE-2023-30861 (published 2023-05-02T18:15Z)

Flask is a lightweight WSGI web application framework. When all of the following conditions are met, a response containing data intended for one client may be cached and subsequently sent by the 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.\n\n1. The application must be hosted behind a caching proxy that does not strip cookies or ignore responses with cookies.\n2. The application sets `session.permanent = True`\n3. The application does not access or modify the session at any point during a request.\n4. `SESSION_REFRESH_EACH_REQUEST` enabled (the default).\n5. The application does not set a `Cache-Control` header to indicate that a page is private or should not be cached.\n\nThis 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. This issue has been fixed in versions 2.3.2 and 2.2.5.

CVSS v3 base score: 7.5, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)

Weakness information:
cwe_id: CWE-539
cwe_name: Use of Persistent Cookies Containing Sensitive Information
description: The web application uses persistent cookies, but the cookies contain sensitive information.
extended_description: Cookies are small bits of data that are sent by the web application but stored locally in the browser. This lets the application use the cookie to pass information between pages and store variable information. The web application controls what information is stored in a cookie and how it is used. Typical types of information stored in cookies are session identifiers, personalization and customization information, and in rare cases even usernames to enable automated logins. There are two different types of cookies: session cookies and persistent cookies. Session cookies just live in the browser's memory and are not stored anywhere, but persistent cookies are stored on the browser's hard drive.   This can cause security and privacy issues depending on the information stored in the cookie and how it is accessed.
         

Fix information:
repo_url: https://github.com/pallets/flask
commit_details: repo_url: https://github.com/pallets/flask
author: David Lord
author_date: 2023-05-01 08:11:41-07:00
msg: Merge pull request from GHSA-m2qf-hxjv-5gpq

set `Vary: Cookie` header consistently for session
repository: repo_url: https://github.com/pallets/flask
repo_name: pallets/flask
description: The Python micro framework for building web applications.
repo_language: Python
owner: pallets
repo_url: https://github.com/pallets/flask
commit_details: repo_url: https://github.com/pallets/flask
author: David Lord
author_date: 2023-05-02 07:18:08-07:00
msg: Merge pull request #5109 from pallets/backport-vary-cookie

backport 2.2.x: set `Vary: Cookie` header consistently for session
repository: repo_url: https://github.com/pallets/flask
repo_name: pallets/flask
description: The Python micro framework for building web applications.
repo_language: Python
owner: pallets