CVE-2025-71325: Picklescan Picklescan Has Pickle Parsing Logic Vulnerability

HIGH
Advisory Identifier: GHSA-9gvj-pp9x-gcfr
CWE-502
Published
Advisory Summary

CVE-2025-71325 is a HIGH picklescan has pickle parsing logic vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Picklescan libraries in the PyPI ecosystem. The issue involves picklescan has pickle parsing logic flaw that leads to malicious pickle file bypass. Remediation is available by upgrading affected packages to version 0.0.27.

CVE-2025-71325 at a Glance

CVE Identifier CVE-2025-71325
GHSA Identifier GHSA-9gvj-pp9x-gcfr
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Picklescan
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-71325

To remediate this vulnerability, upgrade all affected Picklescan dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

picklescan fixed: 0.0.27
pip install picklescan>=0.0.27
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show picklescan

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-71325, inspect your installed packages using pip:

pip show picklescan

Analyze the terminal output to locate any version of Picklescan in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.27), your application is affected.

Note: The pip show picklescan command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Picklescan, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 ``` python 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

CVE-2025-71325 Affected Picklescan Versions

1 component(s)
Fixed Versions:
0.0.27
Product / Package Ecosystem Affected Versions Fixed Version
picklescan
PyPI
< 0.0.27
0.0.27

References

Frequently Asked Questions

What is CVE-2025-71325?
CVE-2025-71325 is a security vulnerability in Picklescan involving Picklescan has pickle parsing logic flaw that leads to malicious pickle file bypass under CWE-502: Deserialization of Untrusted Data.
Which Picklescan versions are affected?
Affected versions include releases prior to 0.0.27 across affected packages: picklescan.
What version fixes CVE-2025-71325?
Upgrading to 0.0.27 (or the latest patched release for your respective branch) resolves the vulnerability.
Is picklescan affected?
Yes, picklescan is affected in releases prior to 0.0.27. Upgrade your dependency to 0.0.27 or later.
What CWE is associated with CVE-2025-71325?
CVE-2025-71325 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check PyPI dependencies for CVE-2025-71325?
Run the dependency tree command: 'pip show picklescan'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9gvj-pp9x-gcfr",
  "modified" : "2026-06-18T14:41:02Z",
  "published" : "2025-08-12T00:13:55Z",
  "aliases" : [ "CVE-2025-71325" ],
  "summary" : "Picklescan has pickle parsing logic flaw that leads to malicious pickle file bypass",
  "details" : "### Details\nThere's a parsing logic error in picklescan and modelscan while trying to deal with opcode `STACK_GLOBAL`.\nFunction `_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.\n\nExample:\n```\n    0: S    STRING     'os' --> arg 0: STRING (untracked argument due to wrong scanning range)\n    6: S    STRING     'system' --> arg 1: STRING (tracked argument)\n   16: \\x93 STACK_GLOBAL\n   17: S    STRING     'ls'\n   23: \\x85 TUPLE1\n   24: R    REDUCE\n   25: .    STOP\n```\n\n\n### PoC\n``` python\nimport pickle\npayload = b\"S'os'\\nS'system'\\n\\x93S'ls'\\n\\x85R.\"\nwith open('bad_pickle.pkl', 'wb') as f:\n    f.write(payload)\npickle.load(open('bad_pickle.pkl', 'rb'))\n```\n\n### Impact\nDetection 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. \n\n### Fix\nTo 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`.\nhttps://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS: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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "picklescan"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.27"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/security/advisories/GHSA-9gvj-pp9x-gcfr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-71325"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/commit/2a8383cfeb4158567f9770d86597300c9e508d0f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/commit/58983e1c20973ac42f2df7ff15d7c8cd32f9b688"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mmaitre314/picklescan"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L255"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/blob/2a8383cfeb4158567f9770d86597300c9e508d0f/src/picklescan/scanner.py#L281"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mmaitre314/picklescan/releases/tag/v0.0.27"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/picklescan-detection-bypass-via-stack-global-opcode-parsing-logic-flaw"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-12T00:13:55Z",
    "nvd_published_at" : null
  }
}