CVE-2025-24794
Python Snowflake connector <3.13.1 OCSP cache uses pickle, allows local priv escalation.
- CVSS 7.8
- CWE-502
- Configuration Issues
- Local
The Snowflake Connector for Python provides an interface for developing Python applications that can connect to Snowflake and perform all standard operations. Snowflake discovered and remediated a vulnerability in the Snowflake Connector for Python. The OCSP response cache uses pickle as the serialization format, potentially leading to local privilege escalation. This vulnerability affects versions 2.7.12 through 3.13.0. Snowflake fixed the issue in version 3.13.1.
- CWE
- CWE-502
- CVSS base score
- 7.8
- Published
- 2025-01-29
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Serialization
- Code defect classification
- Serialization Issues
- Category
- Configuration Issues
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- Snowflake Co
- Fixed by upgrading
- Yes
Solution
Upgrade to version 3.13.1.
Vulnerable code sample
import pickle
import os
class OCSPResponseCache:
def __init__(self, cache_dir):
"""Vulnerable function that demonstrates the security issue."""
self.cache_dir = cache_dir
os.makedirs(cache_dir, exist_ok=True)
def get(self, key):
"""Vulnerable function that demonstrates the security issue."""
cache_file = os.path.join(self.cache_dir, key)
if os.path.exists(cache_file):
with open(cache_file, 'rb') as f:
try:
return pickle.load(f)
except:
return None
return None
def set(self, key, value):
"""Vulnerable function that demonstrates the security issue."""
cache_file = os.path.join(self.cache_dir, key)
with open(cache_file, 'wb') as f:
pickle.dump(value, f)
if __name__ == '__main__':
cache = OCSPResponseCache("ocsp_cache")
data = {"response": "OCSP OK", "timestamp": 1234567890}
cache.set("valid_key", data)
cached_data = cache.get("valid_key")
print("Cache read:", cached_data)
os.system('rm -rf ocsp_cache')Patched code sample
import json
import os
class OCSPResponseCache:
def __init__(self, cache_dir):
"""Secure function that fixes the vulnerability."""
self.cache_dir = cache_dir
os.makedirs(cache_dir, exist_ok=True)
def _sanitize_key(self, key):
"""Secure function that fixes the vulnerability."""
return "".join(c for c in key if c.isalnum() or c in ('-', '_')):
def get(self, key):
"""Secure function that fixes the vulnerability."""
key = self._sanitize_key(key)
cache_file = os.path.join(self.cache_dir, key + ".json")
if os.path.exists(cache_file):
with open(cache_file, 'r') as f:
try:
return json.load(f)
except json.JSONDecodeError:
return None
return None
def set(self, key, value):
"""Secure function that fixes the vulnerability."""
key = self._sanitize_key(key)
if not isinstance(value, (dict, list, str, int, float, bool, type(None))):
raise ValueError("Unsupported type for caching"):
cache_file = os.path.join(self.cache_dir, key + ".json")
with open(cache_file, 'w') as f:
json.dump(value, f)
if __name__ == '__main__':
cache = OCSPResponseCache("ocsp_cache")
data = {"response": "OCSP OK", "timestamp": 1234567890}
cache.set("valid_key", data)
cached_data = cache.get("valid_key")
print("Cache read:", cached_data)
os.system('rm -rf ocsp_cache')Payload
import pickle
import os
class Evil(object):
def __reduce__(self):
return (os.system, ('whoami > /tmp/pwned',))
pickle.dumps(Evil())
Cite this entry
@misc{vaitp:cve202524794,
title = {{Python Snowflake connector <3.13.1 OCSP cache uses pickle, allows local priv escalation.
}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2025},
note = {VAITP Python Vulnerability Dataset, entry CVE-2025-24794},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-24794/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
