picklescan before 0.0.30 (affected versions 0.0.26 and earlier) fails to detect the ensurepip._run_pip built-in function when scanning pickle files, allowing attackers to execute arbitrary code. Malicious pickle files embedding ensurepip._run_pip calls in __reduce__ methods bypass picklescan detection and achieve remote code execution upon pickle.load() invocation.
picklescan - Arbitrary Code Execution via Undetected ensurepip._run_pip Function
Problem type
Affected products
picklescan
< 0.0.30 - AFFECTED
0.0.30 - UNAFFECTED
References
https://github.com/mmaitre314/picklescan/security/advisories/GHSA-xp4f-hrf8-rxw7
https://www.vulncheck.com/advisories/picklescan-arbitrary-code-execution-via-undetected-ensurepip-run-pip-function
GitHub Security Advisories
GHSA-xp4f-hrf8-rxw7
Picklescan is missing detection when calling built-in python ensurepip._run_pip
https://github.com/advisories/GHSA-xp4f-hrf8-rxw7Summary
Using ensurepip._run_pip function, which is a built-in python library function to execute remote pickle file.
Details
The attack payload executes in the following steps:
First, the attacker craft the payload by calling to ensurepip._run_pip function in reduce method Then when the victim after checking whether the pickle file is safe by using Picklescan library and this library doesn't dectect any dangerous functions, decide to pickle.load() this malicious pickle file, thus lead to remote code execution.
PoC
from ensurepip import _run_pip
class EvilEnsurepipRunpip:
def __reduce__(self):
payload = "[(__import__('os').system('whoami'),)]"
return _run_pip, (payload,)
Impact
Who is impacted? Any organization or individual relying on picklescan to detect malicious pickle files inside PyTorch models. What is the impact? Attackers can embed malicious code in pickle file that remains undetected but executes when the pickle file is loaded. Supply Chain Attack: Attackers can distribute infected pickle files across ML models, APIs, or saved Python objects.
Corresponding
JSON source
https://cveawg.mitre.org/api/cve/CVE-2025-71344Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2025-71344",
"assignerOrgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"assignerShortName": "VulnCheck",
"dateUpdated": "2026-06-22T21:04:41.975Z",
"dateReserved": "2026-06-20T12:48:06.735Z",
"datePublished": "2026-06-22T21:04:41.975Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "83251b91-4cc7-4094-a5c7-464a1b83ea10",
"shortName": "VulnCheck",
"dateUpdated": "2026-06-22T21:04:41.975Z"
},
"datePublic": "2025-08-26T00:00:00.000Z",
"title": "picklescan - Arbitrary Code Execution via Undetected ensurepip._run_pip Function",
"descriptions": [
{
"lang": "en",
"value": "picklescan before 0.0.30 (affected versions 0.0.26 and earlier) fails to detect the ensurepip._run_pip built-in function when scanning pickle files, allowing attackers to execute arbitrary code. Malicious pickle files embedding ensurepip._run_pip calls in __reduce__ methods bypass picklescan detection and achieve remote code execution upon pickle.load() invocation."
}
],
"affected": [
{
"vendor": "picklescan",
"product": "picklescan",
"defaultStatus": "unaffected",
"versions": [
{
"version": "0",
"status": "affected",
"versionType": "semver",
"lessThan": "0.0.30"
},
{
"version": "0.0.30",
"status": "unaffected",
"versionType": "semver"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "Deserialization of Untrusted Data",
"cweId": "CWE-502",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://github.com/mmaitre314/picklescan/security/advisories/GHSA-xp4f-hrf8-rxw7",
"name": "GitHub Security Advisory (GHSA-xp4f-hrf8-rxw7)",
"tags": [
"vendor-advisory"
]
},
{
"url": "https://www.vulncheck.com/advisories/picklescan-arbitrary-code-execution-via-undetected-ensurepip-run-pip-function",
"name": "VulnCheck Advisory: picklescan - Arbitrary Code Execution via Undetected ensurepip._run_pip Function",
"tags": [
"third-party-advisory"
]
}
],
"metrics": [
{
"format": "CVSS"
},
{
"format": "CVSS",
"cvssV3_1": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N",
"attackVector": "NETWORK",
"attackComplexity": "LOW",
"privilegesRequired": "NONE",
"userInteraction": "REQUIRED",
"scope": "UNCHANGED",
"confidentialityImpact": "HIGH",
"integrityImpact": "HIGH",
"availabilityImpact": "NONE",
"baseScore": 8.1,
"baseSeverity": "HIGH"
}
}
],
"credits": [
{
"lang": "en",
"value": "FredericDT",
"type": "reporter"
}
]
}
}
}