Bug 2196643 (CVE-2023-30861)

Summary: CVE-2023-30861 flask: Possible disclosure of permanent session cookie due to missing Vary: Cookie header
Product: [Other] Security Response Reporter: Marco Benatto <mbenatto>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: amctagga, aoconnor, apevec, bcl, bdettelb, bniver, dfreiber, eglynn, flucifre, gmeno, jburrell, jjoyce, jwboyer, lhh, mbenjamin, mburns, mgarciac, mhackett, rhos-maint, rogbas, rpittau, sostapov, spower, vereddy, vkumar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: flask 2.2.5, flask 2.3.2 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the Python Flask package. A cached response may contain data for one client sent by a proxy to other clients, including session cookies, resulting in the compromise of data confidentiality contained in the leak requests or cookies. This happens when the following conditions are met by the proxy's behavior regarding cookies and the application's behavior session usage: 1. The caching proxy does not strip or ignore response with cookies 2. The application sets a permanent session 3. The application does not access or modify the session during requests 4. SESSION_REFRESH_EACH_REQUEST is enabled, which is the default Flask behavior 5. The application does not set the Cache-Control header to avoid being cached
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-06-07 14:59:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2196678, 2196679, 2196680, 2196681, 2196682, 2196683, 2196644, 2196645, 2196676, 2196677, 2203721, 2203722, 2203723, 2203724, 2254400    
Bug Blocks: 2196097    

Description Marco Benatto 2023-05-09 17:15:36 UTC
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. 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` 3. The application does not access or modify the session at any point during a request. 4. `SESSION_REFRESH_EACH_REQUEST` 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. This issue has been fixed in versions 2.3.2 and 2.2.5.

Comment 1 Marco Benatto 2023-05-09 17:16:25 UTC
Created python-flask tracking bugs for this issue:

Affects: fedora-all [bug 2196644]
Affects: openstack-rdo [bug 2196645]

Comment 3 Marco Benatto 2023-05-09 20:02:42 UTC
Created python3-flask tracking bugs for this issue:

Affects: epel-7 [bug 2196676]

Comment 8 errata-xmlrpc 2023-06-05 13:55:09 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 17.0

Via RHSA-2023:3440 https://access.redhat.com/errata/RHSA-2023:3440

Comment 9 errata-xmlrpc 2023-06-05 14:08:28 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.2

Via RHSA-2023:3444 https://access.redhat.com/errata/RHSA-2023:3444

Comment 10 errata-xmlrpc 2023-06-05 14:45:56 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.1

Via RHSA-2023:3446 https://access.redhat.com/errata/RHSA-2023:3446

Comment 11 errata-xmlrpc 2023-06-07 07:41:16 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7 Extras

Via RHSA-2023:3525 https://access.redhat.com/errata/RHSA-2023:3525

Comment 12 Product Security DevOps Team 2023-06-07 14:59:38 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2023-30861

Comment 13 errata-xmlrpc 2023-06-13 13:26:20 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.13

Via RHSA-2023:3536 https://access.redhat.com/errata/RHSA-2023:3536

Comment 14 errata-xmlrpc 2023-06-14 04:21:36 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.12

Via RHSA-2023:3545 https://access.redhat.com/errata/RHSA-2023:3545

Comment 15 errata-xmlrpc 2023-11-30 14:35:03 UTC
This issue has been addressed in the following products:

  Red Hat Quay 3

Via RHSA-2023:7341 https://access.redhat.com/errata/RHSA-2023:7341