CVE-2024-6221: Flask Cors Flask-CORS Allows The `Access-Control-Allow-Private-Network` CORS Vulnerability

HIGH
Advisory Identifier: GHSA-hxwh-jpp2-84pm
CVSS 7.5
CWE-284
Published
Advisory Summary

CVE-2024-6221 is a HIGH (CVSS 7.5) flask-cors allows the `access-control-allow-private-network` cors vulnerability (CWE-284: Improper Access Control) affecting Flask Cors libraries in the PyPI ecosystem. The issue involves flask-cors allows the `access-control-allow-private-network` cors header to be set to true by default. Remediation is available by upgrading affected packages to version 4.0.2.

CVE-2024-6221 at a Glance

CVE Identifier CVE-2024-6221
GHSA Identifier GHSA-hxwh-jpp2-84pm
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-284: Improper Access Control
Affected Product Flask Cors
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-6221

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.2
pip install Flask-Cors>=4.0.2
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-6221, 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.2), 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-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. 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

A vulnerability in corydolphin/flask-cors version 4.0.1 allows the `Access-Control-Allow-Private-Network` CORS header to be set to true by default, without any configuration option. This behavior can expose private network resources to unauthorized external access, leading to significant security risks such as data breaches, unauthorized access to sensitive information, and potential network intrusions.

CVE-2024-6221 Affected Flask Cors Versions

1 component(s)
Fixed Versions:
4.0.2
Product / Package Ecosystem Affected Versions Fixed Version
Flask-Cors
PyPI
< 4.0.2
4.0.2

References

Frequently Asked Questions

What is CVE-2024-6221?
CVE-2024-6221 is a security vulnerability in Flask Cors involving Flask-CORS allows the `Access-Control-Allow-Private-Network` CORS header to be set to true by default under CWE-284: Improper Access Control.
Which Flask Cors versions are affected?
Affected versions include releases prior to 4.0.2 across affected packages: Flask-Cors.
What version fixes CVE-2024-6221?
Upgrading to 4.0.2 (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.2. Upgrade your dependency to 4.0.2 or later.
What is the CVSS score of CVE-2024-6221?
CVE-2024-6221 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2024-6221?
CVE-2024-6221 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check PyPI dependencies for CVE-2024-6221?
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-hxwh-jpp2-84pm",
  "modified" : "2026-06-08T20:17:50Z",
  "published" : "2024-08-18T21:31:07Z",
  "aliases" : [ "CVE-2024-6221" ],
  "summary" : "Flask-CORS allows the `Access-Control-Allow-Private-Network` CORS header to be set to true by default",
  "details" : "A vulnerability in corydolphin/flask-cors version 4.0.1 allows the `Access-Control-Allow-Private-Network` CORS header to be set to true by default, without any configuration option. This behavior can expose private network resources to unauthorized external access, leading to significant security risks such as data breaches, unauthorized access to sensitive information, and potential network intrusions.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Flask-Cors"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-6221"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/issues/362"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/pull/363"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/pull/368"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/commit/03aa3f8e2256437f7bad96422a747b98ab5e31bf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/commit/7ae310c56ac30e0b94fb42129aa377bf633256ec"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/commit/c8514760cf03fcce16d77f6db7007aad429c4548"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/corydolphin/flask-cors"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/corydolphin/flask-cors/releases"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/flask-cors/PYSEC-2024-260.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/flask-cors/PYSEC-2024-71.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/a42935fc-6f57-4818-bca4-3d528235df4d"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-19T18:25:39Z",
    "nvd_published_at" : "2024-08-18T19:15:04Z"
  }
}