CVE-2023-30861
Flask vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie header
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.
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)
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.
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-30861RHEL, Rocky, Alma, Fedora
rpm -q flask
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2023-30861Alpine
apk list --installed | grep -i flaskWith 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
- https://github.com/pallets/flask/commit/70f906c51ce49c485f1d355703e9cc3386b1cc2b github.com
- https://github.com/pallets/flask/commit/afd63b16170b7c047f5758eb910c416511e9c965 github.com
- https://github.com/pallets/flask/releases/tag/2.2.5 github.com
- https://github.com/pallets/flask/releases/tag/2.3.2 github.com
- https://www.debian.org/security/2023/dsa-5442 debian.org
- https://security.netapp.com/advisory/ntap-20230818-0006/ security.netapp.com
- https://lists.debian.org/debian-lts-announce/2023/08/msg00024.html lists.debian.org
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.
Vulnpocalypse