Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-6844 Overview
CVE-2024-6844 affects corydolphin/flask-cors version 4.0.1. The vulnerability stems from inconsistent Cross-Origin Resource Sharing (CORS) path matching caused by handling of the + character in URL paths. Flask-CORS passes request.path through the unquote_plus function, which converts + characters to spaces. This incorrect normalization causes endpoint paths to mismatch their configured CORS rules. Attackers can craft URLs that bypass intended CORS restrictions or trigger inconsistent policy application. The flaw is classified under CWE-346: Origin Validation Error.
Critical Impact
Inconsistent CORS enforcement enables unauthorized cross-origin access to protected endpoints, allowing attacker-controlled origins to interact with resources that should be restricted.
Affected Products
- flask-cors_project/flask-cors version 4.0.1
- Python Flask applications using Flask-CORS 4.0.1 for cross-origin policy enforcement
- Debian LTS packages shipping the vulnerable Flask-CORS release
Discovery Timeline
- 2025-03-20 - CVE-2024-6844 published to the National Vulnerability Database (NVD)
- 2025-05 - Debian LTS security notice issued for Flask-CORS
- 2026-06-17 - Last updated in the NVD database
Technical Details for CVE-2024-6844
Vulnerability Analysis
Flask-CORS matches incoming requests against configured CORS rules based on the request path. In version 4.0.1, the library normalizes request.path using Python's urllib.parse.unquote_plus helper. This function decodes + characters to spaces, following application/x-www-form-urlencoded semantics rather than URL path semantics. The transformation changes the effective path used for rule matching, producing a value that no longer corresponds to the route Flask dispatches internally. The result is a divergence between the routing layer and the CORS enforcement layer.
This divergence allows a request to /api+admin to be evaluated as /api admin for CORS matching while Flask routes it as /api+admin. Rules intended for sensitive endpoints may fail to match, causing the library to fall back to permissive defaults or apply an unrelated rule. Conversely, legitimate requests may be blocked when their decoded paths collide with restricted patterns.
Root Cause
The root cause is the use of unquote_plus for path normalization. URL paths follow RFC 3986, where + is a literal character, not a space encoding. unquote_plus applies form-encoding rules that are inappropriate for the path component. Flask-CORS should use urllib.parse.unquote instead, preserving + as a literal.
Attack Vector
The vulnerability is network-exploitable without authentication or user interaction. An attacker crafts an HTTP request containing + characters in the path targeting a Flask application protected by Flask-CORS. The decoded path bypasses the intended rule, and the server returns CORS response headers permitting the attacker's origin. The attacker's browser-controlled page then reads cross-origin responses that should have been blocked.
For exploitation specifics, see the Huntr bounty report.
Detection Methods for CVE-2024-6844
Indicators of Compromise
- HTTP request logs containing + characters in paths targeting API endpoints protected by Flask-CORS
- CORS preflight (OPTIONS) responses returning Access-Control-Allow-Origin values that do not match the configured policy
- Repeated requests from unexpected Origin header values receiving successful cross-origin responses
Detection Strategies
- Inspect dependency manifests (requirements.txt, Pipfile.lock, poetry.lock) for Flask-Cors==4.0.1 or earlier
- Audit web server access logs for requests containing + characters in URL paths followed by successful CORS header issuance
- Correlate Origin header values with configured allowed origins to surface policy divergence
Monitoring Recommendations
- Enable structured HTTP logging that captures Origin, Access-Control-Allow-Origin, and raw request paths
- Alert on OPTIONS preflight requests that produce permissive CORS headers for sensitive routes
- Track Software Composition Analysis (SCA) findings for Flask-CORS versions across build pipelines
How to Mitigate CVE-2024-6844
Immediate Actions Required
- Upgrade Flask-Cors to the latest patched release available from upstream or distribution channels
- Review all CORS rule definitions for routes whose paths may contain + characters
- Restrict Access-Control-Allow-Origin configurations to explicit origins rather than wildcard values
Patch Information
The maintainers of Flask-CORS addressed the issue upstream following the Huntr disclosure. Debian LTS users should apply the update described in the Debian LTS Security Notice. Verify the installed version using pip show flask-cors and update via pip install --upgrade flask-cors or the appropriate distribution package manager.
Workarounds
- Deploy a reverse proxy or Web Application Firewall (WAF) rule that normalizes or rejects paths containing + characters before they reach Flask
- Enforce CORS policy at the ingress or API gateway layer rather than relying solely on Flask-CORS
- Define CORS rules using exact-match route patterns and avoid regex rules that interact unpredictably with normalized paths
# Verify installed Flask-CORS version and upgrade
pip show flask-cors
pip install --upgrade flask-cors
# Audit dependency pins in requirements files
grep -R "[Ff]lask-[Cc]ors" requirements*.txt Pipfile* poetry.lock 2>/dev/null
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

