CVE-2023-30861

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

7.5 high EPSS 1.25%

Published 2 May 2023 Updated 13 Feb 2025 CNA: GitHub_M

Check your servers for CVE-2023-30861

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2023-30861 affects flask, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Severity (CVSS)

7.5 high CVSS 3.1 from GitHub_M (CNA)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Attack vector
network: an attacker can reach the vulnerable part over the network, often from the internet
Attack complexity
low: an attack works without special conditions
Privileges required
none: the attacker does not need an account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity none, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 1.25%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 70.2% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 30 Jan 2025):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Weakness

  • CWE-539 Use of Persistent Cookies Containing Sensitive Information

Affected products

As the CNA lists them.

ProductVersions
flask
affected >= 2.3.0, < 2.3.2
affected < 2.2.5

Is my server affected?

Find the installed version of flask and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i flask
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2023-30861 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2023-30861

RHEL, Rocky, Alma, Fedora

rpm -q flask
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2023-30861

Alpine

apk list --installed | grep -i flask

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2023-30861
trivy image --scanners vuln IMAGE | grep CVE-2023-30861

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Advisories

Other references

Source: the record CVE-2023-30861 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.