Skip to content
OpenAdvisories
High · 7.5 Public exploit CVE-2023-30861 EUVD-2023-0080GHSA-m2qf-hxjv-5gpqPYSEC-2023-62

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

Published May 2, 2023 · Updated Feb 13, 2025 · Assigned by GitHub_M

Description

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.

Affected products

VendorProductAffectedFixed
pallets flask >= 2.3.0, < 2.3.2, < 2.2.5 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 flask 2.2.2-3 —
Debian 13 flask 2.2.2-3 —
Debian 12 flask 2.2.2-3 —
Debian 11 flask 1.1.2-2+deb11u1 DSA-5442-1
Debian 10 flask 1.0.2-3+deb10u1 DLA-3536-1
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS flask 2.0.1-2ubuntu1.1 USN-6111-1
Ubuntu 20.04 LTS flask 1.1.1-2ubuntu0.1 USN-6111-1
ReleasePackageFixed inAdvisory
Red Hat Rhel Extras Other 7 python-flask 1:0.10.1-7.el7_9 RHSA-2023:3525
Red Hat Openshift Ironic 4 python-flask +2 1:1.1.2-6.el8 RHSA-2023:3545, RHSA-2023:3541, RHSA-2023:3536
Red Hat OpenStack 17 python-flask +1 1:1.1.2-6.el9ost RHSA-2023:3440
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Red Hat OpenStack 16 python-flask +1 1:1.0.2-8.el8ost RHSA-2023:3446, RHSA-2023:3444
Red Hat OpenShift 4 NetworkManager +15 1:1.42.2-2.el9_2 RHSA-2023:3536
Red Hat OpenShift 4 conmon 3:2.1.7-1.1.rhaos4.13.el9 RHSA-2023:3536
Red Hat OpenShift 4 cri-o 1.24.5-5.rhaos4.11.git8bf967b.el8 RHSA-2023:3541, RHSA-2023:3536
Red Hat OpenShift 4 openshift +1 4.13.0-202305312300.p0.g7a891f0.assembly.stream.el8 RHSA-2023:3536
Red Hat OpenShift 4 openshift-ansible +1 4.13.0-202305301841.p0.g148be47.assembly.stream.el8 RHSA-2023:3536
Red Hat OpenShift 4 openshift-clients +1 4.13.0-202305312300.p0.g05d83ef.assembly.stream.el8 RHSA-2023:3536
Red Hat OpenShift 4 podman +6 3:4.2.0-4.1.rhaos4.12.el8 RHSA-2023:3545
ReleasePackageFixed inAdvisory
SLES 15 SP5 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1, SUSE-SU-2023:2263-1
SLES 15 SP4 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1, SUSE-SU-2023:2263-1
SLES 15 SP3 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLES 15 SP2 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLES 15 SP1 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
Show 11 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 15 SP3 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLES for SAP 15 SP2 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLES for SAP 15 SP1 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLE Real Time 15 SP3 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLE HPC 15 SP3 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLE HPC 15 SP2 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SLE HPC 15 SP1 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SUSE Manager Server 4.2 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SUSE Manager Proxy 4.2 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SUSE Enterprise Storage 7.1 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
SUSE Enterprise Storage 7 python-Flask 1.0.2-150100.6.3.1 SUSE-SU-2023:2264-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-Flask 3.1.3-3.1 openSUSE-SU-2026:11902-1
openSUSE Leap 15.5 python-Flask 1.0.4-150400.3.3.1 SUSE-SU-2023:2263-2
openSUSE Leap 15.4 python-Flask 1.0.4-150400.3.3.1 SUSE-SU-2023:2263-1

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 python3-flask +1 1:1.1.2-5.amzn2023.0.3 ALAS2023-2023-183

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 python-flask No fix yet —
Azure Linux 2 (CBL-Mariner) python-flask No fix yet —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 8 python3-flask 1:0.12.2-4.0.1.el8 ELSA-2023-12710

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 2 repositories

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI flask >= 2.3.0, < 2.3.2 2.3.2 GHSA-m2qf-hxjv-5gpq
PyPI flask < 2.2.5 2.2.5 GHSA-m2qf-hxjv-5gpq
PyPI flask < 2.2.5 · >= 2.3.0, < 2.3.2 2.2.5, 2.3.2 PYSEC-2023-62

Advisories 21

References