CVE-2024-6844

5.3 MEDIUM

📋 TL;DR

This vulnerability in flask-cors 4.0.1 causes inconsistent CORS policy matching due to improper URL path normalization where '+' characters are converted to spaces. This can lead to either unauthorized cross-origin access or legitimate requests being blocked. Anyone using flask-cors 4.0.1 with CORS-configured endpoints containing '+' characters in their paths is affected.

💻 Affected Systems

Products:
  • corydolphin/flask-cors
Versions: 4.0.1
Operating Systems: all
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using CORS-configured endpoints with '+' characters in URL paths. The vulnerability is in path normalization logic.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could bypass CORS restrictions and perform cross-origin attacks against endpoints that should be protected, potentially leading to data theft or CSRF attacks.

🟠

Likely Case

Inconsistent CORS behavior causing legitimate requests to be blocked or unauthorized cross-origin requests to succeed, leading to application errors or security policy violations.

🟢

If Mitigated

Limited impact if proper input validation and additional security layers are in place, though CORS policy enforcement remains unreliable.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: LOW

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires knowledge of endpoint paths containing '+' characters and understanding of CORS policy bypass techniques.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.0.2

Vendor Advisory: https://github.com/corydolphin/flask-cors/security/advisories/GHSA-4j8q-2j8q-2j8q

Restart Required: Yes

Instructions:

1. Update flask-cors to version 4.0.2 or later using pip install flask-cors==4.0.2. 2. Restart your Flask application. 3. Verify the fix by testing endpoints with '+' characters in paths.

🔧 Temporary Workarounds

Avoid '+' in URL paths

all

Modify application endpoints to avoid using '+' characters in URL paths that have CORS configurations.

Use URL encoding

all

Ensure all URL paths with special characters are properly URL-encoded before CORS processing.

🧯 If You Can't Patch

  • Implement additional CORS validation at the application layer using middleware
  • Use WAF rules to block suspicious cross-origin requests

🔍 How to Verify

Check if Vulnerable:

Check if using flask-cors 4.0.1 and if any CORS-configured endpoints contain '+' characters in their URL paths.

Check Version:

pip show flask-cors | grep Version

Verify Fix Applied:

After updating to 4.0.2+, test endpoints with '+' characters to ensure CORS policies are correctly applied.

📡 Detection & Monitoring

Log Indicators:

  • CORS policy mismatches in application logs
  • Unexpected cross-origin requests succeeding or being blocked

Network Indicators:

  • HTTP requests with '+' characters in paths to CORS-protected endpoints
  • Inconsistent CORS header responses

SIEM Query:

source="application.logs" AND ("CORS mismatch" OR "cross-origin" AND "+" AND "path")

🔗 References

📤 Share & Export