CVE-2024-6221: Flask Cors Flask-CORS Allows The `Access-Control-Allow-Private-Network` CORS Vulnerability
HIGHCVE-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
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).
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.
pip install Flask-Cors>=4.0.2
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
CVE-2024-6221 Affected Flask Cors Versions
1 component(s)| 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?
Which Flask Cors versions are affected?
What version fixes CVE-2024-6221?
Is Flask-Cors affected?
What is the CVSS score of CVE-2024-6221?
What CWE is associated with CVE-2024-6221?
How can I check PyPI dependencies for CVE-2024-6221?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}