VYPR
High severity8.9NVD Advisory· Published Jun 17, 2026· Updated Jun 17, 2026

picklescan - Detection Bypass via STACK_GLOBAL Opcode Parsing Logic Flaw

CVE-2025-71325

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.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

1

Patches

Vulnerability mechanics

Root cause

"Off-by-one error in the `_list_globals` function's loop range when tracking arguments for the `STACK_GLOBAL` opcode, causing the argument at position 0 to be ignored."

Attack vector

An attacker crafts a pickle file where the first argument (e.g., a string like `'os'`) is placed at opcode position 0, which the flawed `_list_globals` loop fails to track [ref_id=1]. The scanner then encounters a `STACK_GLOBAL` opcode with only one tracked argument, raising an exception (`Found 1 values for STACK_GLOBAL at position n instead of 2.`) instead of detecting the malicious import [ref_id=1]. This exception causes the scan to abort or skip the dangerous pickle, allowing the malicious payload to be loaded undetected [ref_id=1]. The attack requires no authentication and can be delivered via any vector that supplies a pickle file to the scanner (e.g., uploaded files, Hugging Face model repositories) [ref_id=1].

Affected code

The vulnerability resides in the `_list_globals` function within picklescan (and modelscan). When handling the `STACK_GLOBAL` opcode at position `n`, the loop incorrectly uses `range(1, n)` instead of `range(1, n+1)`, causing the argument at position 0 to be untracked [ref_id=1]. This parsing logic error allows a malicious pickle file to bypass detection by triggering an unexpected exception when only one argument is found instead of the expected two [ref_id=1].

What the fix does

The patch changes the loop range in `_list_globals` from `range(1, n)` to `range(1, n+1)`, ensuring that the opcode at position 0 is included when tracking arguments for `STACK_GLOBAL` [ref_id=1]. This closes the gap that allowed attackers to place a malicious argument at position 0, which previously went untracked and caused an exception-based bypass [ref_id=1]. The fix is minimal and targeted, correcting only the off-by-one error in the argument tracking logic.

Preconditions

  • inputThe attacker must supply a pickle file that places the first argument at opcode position 0, which the flawed scanner loop does not track.
  • configThe target must use picklescan (or modelscan) version < 0.0.27 to scan the malicious pickle file.

Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

9

News mentions

0

No linked articles in our index yet.