CVE-2024-1681: Flask cors Flask-cors Vulnerable To Log Injection Vulnerability
MODERATECVE-2024-1681 is a MODERATE (CVSS 5.3) flask-cors vulnerable to log injection vulnerability (CWE-117: Improper Output Neutralization for Logs) affecting Flask cors libraries in the PyPI ecosystem. The issue involves flask-cors vulnerable to log injection when the log level is set to debug. Remediation is available by upgrading affected packages to version 4.0.1.
CVE-2024-1681 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N).
How to Fix CVE-2024-1681
To remediate this vulnerability, upgrade all affected Flask cors dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install flask-cors>=4.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show flask-cors
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-1681, inspect your installed packages using pip:
pip show flask-cors
Analyze the terminal output to locate any version of Flask cors in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.1), your application is affected.
Note: The pip show flask-cors command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-117: Improper Output Neutralization for Logs, where the product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file. In Flask cors, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-1681 Affected Flask cors Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
flask-cors
|
PyPI |
< 4.0.1
|
4.0.1
|
References
Frequently Asked Questions
What is CVE-2024-1681?
Which Flask cors versions are affected?
What version fixes CVE-2024-1681?
Is flask-cors affected?
What is the CVSS score of CVE-2024-1681?
What CWE is associated with CVE-2024-1681?
How can I check PyPI dependencies for CVE-2024-1681?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-84pr-m4jr-85g5",
"modified" : "2026-06-05T17:54:17Z",
"published" : "2024-04-19T21:31:08Z",
"aliases" : [ "CVE-2024-1681" ],
"summary" : "flask-cors vulnerable to log injection when the log level is set to debug",
"details" : "corydolphin/flask-cors is vulnerable to log injection when the log level is set to debug. An attacker can inject fake log entries into the log file by sending a specially crafted GET request containing a CRLF sequence in the request path. This vulnerability allows attackers to corrupt log files, potentially covering tracks of other attacks, confusing log post-processing tools, and forging log entries. The issue is due to improper output neutralization for logs.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "flask-cors"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.0.0"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-1681"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/corydolphin/flask-cors"
}, {
"type" : "WEB",
"url" : "https://github.com/corydolphin/flask-cors/blob/40acc8092332dfed4bb54d7a4f89a6d479466de7/flask_cors/extension.py#L194"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/flask-cors/PYSEC-2024-271.yaml"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/25a7a0ba-9fa2-4777-acb6-03e5539bb644"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2025/05/msg00049.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-117" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-04-22T14:08:38Z",
"nvd_published_at" : "2024-04-19T20:15:09Z"
}
}