Headline
CVE-2021-33026: Extensible serializers support by subnix · Pull Request #209 · pallets-eco/flask-caching
** DISPUTED ** The Flask-Caching extension through 1.10.1 for Flask relies on Pickle for serialization, 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: a third party indicates 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.
I just submitted an update request to mitre.org with the following description:
The stated vulnerability is not a vulnerability in flask-caching itself, but only makes flask-caching one intermediate member in a chain of multiple security issues.
For an attack like this to work, an attacker must:
- Be able to write arbitrary values to the cache
- Be able to generate a cache key that will collide with a value being read by the application
- Cause the application to read a maliciously-injected value
Any situation where all 3 of those is true is a situation where the application has larger problems; for example, if someone’s able to inject malicious cached rendered pages into a Flask app’s cache, then they can make the website say literally anything they want, regardless of whether it involves the execution of remote code. Basically, the Pickle vulnerability follows from a website already being extremely vulnerable (due to conditions 1 and 2 being met).
There has not been a single confirmed case of this exploit having ever occurred, despite the description being public for two years; the attack is only theoretical, requires a very specific exploit path which requires there to be much worse security issues to be visible in the first place, and it boils down to “if you let people upload code to your server, they can run it.”
This CVE should be rejected, or at least have its severity reduced, with the following base metrics:
Attack complexity: high (requires multiple failures in security infrastructure)
User interaction: required (the exploit requires a web request that reads from a poisoned cache item)
Confidentiality: none (this does not directly result in the disclosure of confidential data)
Availability: none (it’s regarding data in a cache, which is inherently transitory/non-durable)