Vulnerabilities in pkg:pypi/flask-cors

PACKAGE
Advisory Identifier: GHSA-84pr-m4jr-85g5
Advisory Summary

CVE-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.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/flask-cors

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/flask-cors. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-84pr-m4jr-85g5 CVE-2024-1681 MODERATE flask-cors vulnerable to log injection when the log level is set to debug
GHSA-43qf-4rqw-9q2g CVE-2024-6866 MODERATE Flask-CORS vulnerable to Improper Handling of Case Sensitivity
GHSA-8vgw-p6qm-5gr7 CVE-2024-6844 MODERATE Flask-CORS allows for inconsistent CORS matching
GHSA-7rxf-gvfg-47g4 CVE-2024-6839 MODERATE Flask-CORS improper regex path matching vulnerability

CVE-2024-1681 at a Glance

CVE Identifier CVE-2024-1681
GHSA Identifier GHSA-84pr-m4jr-85g5
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-117: Improper Output Neutralization for Logs
Affected Product Flask cors
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (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.

flask-cors fixed: 4.0.1
pip install flask-cors>=4.0.1
Verify Direct and Transitive Dependencies

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

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.

CVE-2024-1681 Affected Flask cors Versions

1 component(s)
Fixed Versions:
4.0.1
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?
CVE-2024-1681 is a security vulnerability in Flask cors involving flask-cors vulnerable to log injection when the log level is set to debug under CWE-117: Improper Output Neutralization for Logs.
Which Flask cors versions are affected?
Affected versions include releases prior to 4.0.1 across affected packages: flask-cors.
What version fixes CVE-2024-1681?
Upgrading to 4.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is flask-cors affected?
Yes, flask-cors is affected in releases prior to 4.0.1. Upgrade your dependency to 4.0.1 or later.
What is the CVSS score of CVE-2024-1681?
CVE-2024-1681 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2024-1681?
CVE-2024-1681 is classified under CWE-117: Improper Output Neutralization for Logs (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.).
How can I check PyPI dependencies for CVE-2024-1681?
Run the dependency tree command: 'pip show flask-cors'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}