PyPI: flask-caching
CVE-2021-33026
Safety vulnerability ID: SFTY-20210513-96373
Safety legacy ID: pyup.io-40459
Flask-caching is vulnerable to CVE-2021-33026: Flask-Caching extension for Flask relies on Pickle for deserialization, which may lead to remote code execution or local privilege escalation. If an attacker gains access to cache storage (e.g., filesystem, Memcached, Redis, etc.), they can construct a crafted payload, poison the cache, and execute Python code. NOTE: Project maintainers indicate that exploitation is extremely unlikely unless the machine is already compromised; in other cases, the attacker would be unable to write their payload to the cache and generate the required collision.
Overview
Deserialization of Untrusted Data in Flask-Caching
Advisory
Flask-caching is vulnerable to CVE-2021-33026: Flask-Caching extension for Flask relies on Pickle for deserialization, which may lead to remote code execution or local privilege escalation. If an attacker gains access to cache storage (e.g., filesystem, Memcached, Redis, etc.), they can construct a crafted payload, poison the cache, and execute Python code. NOTE: Project maintainers indicate that exploitation is extremely unlikely unless the machine is already compromised; in other cases, the attacker would be unable to write their payload to the cache and generate the required collision.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20210513-96373/CVE-2021-33026
- https://nvd.nist.gov/vuln/detail/CVE-2021-33026
- https://github.com/sh4nks/flask-caching/pull/209
- https://github.com/pallets-eco/flask-caching/pull/209#issuecomment-1136397937
- https://github.com/advisories/GHSA-656c-6cxf-hvcv
- https://github.com/pypa/advisory-database/tree/main/vulns/flask-caching/PYSEC-2021-13.yaml
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
