Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safety problem #257

Closed
MuslimBeibytuly opened this issue Jun 1, 2021 · 11 comments · Fixed by #308
Closed

safety problem #257

MuslimBeibytuly opened this issue Jun 1, 2021 · 11 comments · Fixed by #308

Comments

@MuslimBeibytuly
Copy link

docker image:
python:3.9.5-slim
apache-airflow==2.1.0
image

@taylorwilsdon
Copy link

Watching this as well, it's not really an issue with flask-caching directly but rather it's use of Pickle for serialization (it's the usage of Pickle that creates the vulnerability) - the CVE is https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33026 and for whatever its worth, there are many (many!) other libraries that share the same "vulnerability" and many have disputed that, Flask-Caching has not.

@MuslimBeibytuly
Copy link
Author

@tbarrettwilsdon is there a opportunity to change default serialization format to xml/json(using ujson/orjson), but saving an option to keep current pickle serialization?

@maxim-smirnov
Copy link

maxim-smirnov commented Jun 2, 2021

Watching this as well, it's not really an issue with flask-caching directly but rather it's use of Pickle for serialization (it's the usage of Pickle that creates the vulnerability) - the CVE is https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33026 and for whatever its worth, there are many (many!) other libraries that share the same "vulnerability" and many have disputed that, Flask-Caching has not.

@tbarrettwilsdon
Other libraries have stated, that pickle is not used with untrusted data. In this case (flask-caching) Redis, Memcached or other caching backend can be used, so malicious payload can be injected.

@ndouchin
Copy link

ndouchin commented Jun 4, 2021

There is an open merge request for this issue: #209

Thanks to this MR, we would be able to choose which serializer we want to use with Flask-Caching.

@swiftace
Copy link

Is this likely to be fixed or the MR above merged soon? This is causing me problems with an upstream component requiring Flask-Caching as a dependency.

@ThiefMaster
Copy link
Contributor

IMHO the CVE is bogus. If someone has write access to your cache's storage, you are most likely already compromised. So it's perfectly fine and safe to use this extension (or a component using it) as long as your environment is properly configured and secured (ie don't expose your redis/memcached to untrusted users or the internet, and don't let untrusted users write arbitrary files on your server if you use file-based storage)

@long76
Copy link

long76 commented Jul 13, 2021

+1
Dependabot alerts
Screenshot_20210713_115150

@torotil
Copy link

torotil commented Nov 24, 2021

If someone has write access to your cache's storage, you are most likely already compromised.

I agree mostly, but there is the odd chance that an attacker can somehow manipulate cached values without having already enough privileges to execute arbitrary Python code (as the flask app user). Essentially this turns any cache poisoning attack into an arbitrary code execution attack.

@ThiefMaster
Copy link
Contributor

AFAIK cache poisoning usually means caching user-controlled data through some vulnerability (e.g. in order to serve bad data to other users), but not being able to write raw data to the cache backend through other means..

@torotil
Copy link

torotil commented Nov 24, 2021

Ok, I might have used the word “cache poisoning“ wrongly. The thought still applies. Write access to the cache backend doesn’t imply the ability to execute arbitrary code (or even access as a local user). So this could be used for privilege escalation.

@northernSage
Copy link
Member

Means of avoiding pickle by using custom serialization strategies have being added to cachelib in pallets-eco/cachelib#63 which will soon be integrated with flask-caching. See #308 and #209 for more information.

@northernSage northernSage linked a pull request Mar 13, 2022 that will close this issue
9 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

9 participants