Directory Traversal Vulnerability in Flask-CORS Package
Summary
CVE-2020-25032: An issue was discovered in Flask-CORS (aka CORS Middleware for Flask) before 3.0.9. Affects python-flask-cors across 2 version ranges.
< 3.0.9-1
< 91babb941e07a1f45636bdcb75675f13ce1503a2
Fixed in 3.0.9-1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Flask-CORS is a middleware for Flask applications that enables Cross-Origin Resource Sharing (CORS). This package allows developers to configure their Flask applications to accept requests from different origins, enhancing the flexibility of web applications. However, prior to version 3.0.9, Flask-CORS was susceptible to a directory traversal vulnerability that could allow unauthorized access to private resources.
Vulnerability Detail
An issue was discovered in Flask-CORS before version 3.0.9, which allows for directory traversal attacks. This vulnerability arises from improper resource matching that does not ensure pathnames are in a canonical format. As a result, an attacker could exploit this flaw to access sensitive files and resources that should be restricted, potentially leading to data breaches or unauthorized access to critical application components.
How To Fix
Minimum fixed version
3.0.9-1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade python-flask-cors
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading is not immediately possible, a temporary workaround is to implement additional validation on the input paths to ensure they do not contain any traversal characters (e.g., '../'). This can be done by sanitizing user inputs before processing them.
Conclusion
The directory traversal vulnerability in Flask-CORS poses a significant risk to applications using this middleware. It is crucial for developers to upgrade to the latest version to mitigate potential security threats. Regular monitoring and validation of dependencies can help maintain application security.
See every vulnerability recorded for python-flask-cors →
FAQ
The CVSS score of this vulnerability is 7.5, indicating a high severity level.
Flask-CORS versions prior to 3.0.9 are affected by this vulnerability.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
Exploitation of this vulnerability could lead to unauthorized access to sensitive files and resources, potentially resulting in data breaches.
Yes, upgrading to Flask-CORS version 3.0.9 or later addresses this vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for python-flask-cors.