Skip to content

pickle-sentry 0.5.0

Latest

Choose a tag to compare

@Sun-Wukhan Sun-Wukhan released this 30 Nov 21:23

pickle-sentry 0.5.0 — invoked stdlib command-execution globals now flag critical

New rule PICKLE-INVOKED-DANGEROUS-GLOBAL (critical): the scanner's abstract interpreter now classifies command-execution-capable stdlib globals as dangerous only when a payload actually invokes them (REDUCE / NEWOBJ / INST). The set follows Wiz's analysis of GHSA-g38g-8gr9-h9xp: uuid._get_command_stdout, _osx_support._read_output, _osx_support._find_build_tool, _aix_support._read_cmd_output, _pyrepl.pager.pipe_pager, _pyrepl.pager.tempfile_pager, imaplib.IMAP4_stream, test.support.script_helper.assert_python_ok / assert_python_failure.

This is invocation precision, not a bigger blocklist: a pickle that merely references one of these globals is NOT flagged high, and benign neighbours such as uuid.uuid4 stay unflagged.

  • Benchmark, same corpus, same criteria: malicious caught 75 → 76 / 96, benign false flags unchanged (5 / 24), zero regressions. The newly caught file is the uuid GHSA fixture (uuid. was previously swallowed by the benign-prefix list); the other five GHSA-g38g fixtures, already flagged high, now flag critical under the precise rule. Remaining GHSA misses invoke torch.* / numpy.* globals — a different class, stated plainly in docs/BENCHMARK.md.
  • 19 new tests: for each target global, an invoking payload flags critical and a referencing payload does not flag high, plus a canary proving an invoking payload is flagged but never executed. 113 tests total, zero dependencies, Python 3.9+.

Install: pip install pickle-sentry==0.5.0