CVE-2024-6221: Flask-Cors improper access control in Private Network Access header

CVE-2024-6221 · Severity: high · CVSS 7.5 · Published 2024-08-18

A vulnerability in the Flask-Cors library, which manages cross-origin resource sharing for web applications, could allow external websites to access resources on a company's private internal network. By default, the library incorrectly signals to web browsers that private network requests are permitted, potentially exposing sensitive internal data or services to unauthorized parties. This could lead to data breaches or unauthorized access to internal systems that were intended to be isolated from the public internet.

Technologies: Flask-Cors (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2024-6221 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2024-6221 being exploited in the wild.
How severe is CVE-2024-6221?
High severity, with a CVSS score of 7.5, published 18 August 2024.
Which products and versions are affected?
Flask-Cors (PyPI) < 4.0.2, ECOSYSTEM:introduced=0,fixed=4.0.2, ECOSYSTEM:introduced=0,last_affected=4.0.1.
Is there a fix for CVE-2024-6221?
Yes. Flask-Cors (PyPI): upgrade to 4.0.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2024-6221 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2024-6221?
Check whether you run Flask-Cors (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Flask-Cors (PyPI): upgrade to 4.0.2 or later
    pip install "Flask-Cors>=4.0.2"

Technical details

A vulnerability in Flask-Cors version 4.0.1 (and earlier) causes the 'Access-Control-Allow-Private-Network' CORS header to be set to 'true' by default without a configuration option to disable it. This behavior violates the Private Network Access (PNA) specification, which is designed to prevent public websites from making unauthorized requests to internal or local network endpoints. An attacker can exploit this by hosting a malicious website that, when visited by a user inside a private network, can successfully perform cross-origin requests to internal services that use the vulnerable Flask-Cors configuration. This can result in the unauthorized disclosure of sensitive information from internal APIs. The issue is resolved in version 4.0.2.

Affected products

  • corydolphin Flask-Cors < 4.0.2

Identifiers

  • CVE-2024-6221
  • GHSA-hxwh-jpp2-84pm
  • PYSEC-2024-260
  • PYSEC-2024-71

Timeline

  • 2024-08-18: advisory: GitHub Advisory published
  • 2024-08-18: disclosed: NVD publication date

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.