Flask-CORS allows for inconsistent CORS matching
Flask-CORS normalises request paths with unquote_plus, which turns '+' into a space, so CORS rules can be matched against the wrong path. This can let a request from an untrusted origin be treated as allowed, or block a legitimate one.
corydolphin/flask-cors
Originally disclosed on huntr
A vulnerability in corydolphin/flask-cors version 5.0.1 allows for inconsistent CORS matching due to the handling of the '+' character in URL paths. The request.path is passed through the unquote_plus function, which converts the '+' character to a space ' '. This behavior leads to incorrect path normalization, causing potential mismatches in CORS configuration. As a result, endpoints may not be matched correctly to their CORS settings, leading to unexpected CORS policy application. This can cause unauthorized cross-origin access or block valid requests, creating security vulnerabilities and usability issues.
From the GitHub Advisory Database (GHSA-8vgw-p6qm-5gr7, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the library normalises the request path with unquote_plus, which decodes '+' as a space, so the path used for CORS matching differs from the actual request path.
Impact
Endpoints may be matched to the wrong CORS settings, which could allow unauthorised cross-origin access or block valid requests.
What the attacker needed
A Flask app using flask-cors 5.0.1; a path containing a '+' character
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
CORS is a browser rule that decides which other websites may read responses from a site. Flask-CORS is a library that applies those rules based on the URL path. Here it cleans up the path in a way that changes '+' into a space, so the path it checks is not the real one, and the wrong rule can be applied.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.