CVE-2025-71325
JSON

9.3critical

picklescan - Detection Bypass via STACK_GLOBAL Opcode Parsing Logic Flaw

Severity
9.3critical CVSS:4.0 by VulnCheck
Exploit likelihood
0.60% (higher than 50% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-9gvj-pp9x-gcfrPYSEC-2026-1788

Description

picklescan before 0.0.27 contains a parsing logic error in the _list_globals function when handling STACK_GLOBAL opcodes, failing to track arguments in the correct range and allowing malicious pickle files to bypass detection. Attackers can craft pickle files with arguments at position zero to trigger unexpected exceptions and evade security scanning.

Affected

Product or packageVersionsReported by
picklescan picklescanbefore 0.0.27
Not affected: 0.0.27
CVE List
picklescan (PyPI)before 0.0.27GitHub Advisory Database, PyPA Advisory Database

All scores

VulnCheck9.3critical CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
VulnCheck9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P

Classification

CWE-391CWE-502

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

picklescan before 0.0.27 contains a parsing logic error in the _list_globals function when handling STACK_GLOBAL opcodes, failing to track arguments in the correct range and allowing malicious pickle files to bypass detection. Attackers can craft pickle files with arguments at position zero to trigger unexpected exceptions and evade security scanning.

GitHub Advisory Database
Details

There's a parsing logic error in picklescan and modelscan while trying to deal with opcode STACK_GLOBAL. Function _list_globals when handling STACK_GLOBAL at position n, it is expected to track two arguments but in wrong range. The loop only consider the range from 1 to n-1 but forgets to consider the opcode at position 0. The correct range should be 0 to n-1. Attacker can put arg in position 0, thus the parser can only tract one argument. Then, the exception https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L281 will be triggered. Thus it can cause detection bypass since the malicious pickle file will trigger unexpected exceptions.

Example:

    0: S    STRING     'os' --> arg 0: STRING (untracked argument due to wrong scanning range)
    6: S    STRING     'system' --> arg 1: STRING (tracked argument)
   16: \x93 STACK_GLOBAL
   17: S    STRING     'ls'
   23: \x85 TUPLE1
   24: R    REDUCE
   25: .    STOP
PoC
import pickle
payload = b"S'os'\nS'system'\n\x93S'ls'\n\x85R."
with open('bad_pickle.pkl', 'wb') as f:
    f.write(payload)
pickle.load(open('bad_pickle.pkl', 'rb'))
Impact

Detection bypass in both picklescan and modelscan. Note that it also affects the online hugging face pickle scanners, making the malicious pickle file bypass the detection.

Fix

To fix the range here, change range(1, n) to range(1, n+1) to ensure that n-offset stays within the range of 0 to n. https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255

NVD (es)

picklescan anterior a la 0.0.27 contiene un error de lógica de análisis en la función _list_globals al manejar opcodes STACK_GLOBAL, fallando en rastrear argumentos en el rango correcto y permitiendo que archivos pickle maliciosos eludan la detección. Los atacantes pueden elaborar archivos pickle con argumentos en la posición cero para desencadenar excepciones inesperadas y evadir el escaneo de seguridad.

References

https://github.com/mmaitre314/picklescan/security/advisories/GHSA-9gvj-pp9x-gcfrexploit, vendor-advisory, web
https://github.com/mmaitre314/picklescan/commit/2a8383cfeb4158567f9770d86597300c9e508d0fpatch, web
https://www.vulncheck.com/advisories/picklescan-detection-bypass-via-stack-global-opcode-parsing-logic-flawthird-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2025-71325advisory
https://github.com/mmaitre314/picklescan/commit/58983e1c20973ac42f2df7ff15d7c8cd32f9b688web
https://github.com/mmaitre314/picklescanpackage
https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255web
https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L281web
https://github.com/mmaitre314/picklescan/releases/tag/v0.0.27web
https://pypi.org/project/picklescanpackage
https://github.com/advisories/GHSA-9gvj-pp9x-gcfradvisory

Sources

SourceRecordLicence
CVE ListCVE-2025-71325 changed 2026-11-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-9gvj-pp9x-gcfr changed 2026-07-07CC-BY-4.0
NVDCVE-2025-71325 changed 2026-10-12Public domain
PyPA Advisory DatabasePYSEC-2026-1788 changed 2026-07-07CC-BY-4.0