Skip to content

pickle-sentry 0.2.0

Choose a tag to compare

@Sun-Wukhan Sun-Wukhan released this 09 Nov 20:12
· 12 commits to main since this release

pickle-sentry 0.2.0

First public release. Scan code and dataset files for unsafe pickle deserialization — including the Hugging Face datasets pandas builder RCE, CVE-2026-57845 (CVSS 8.8, affects datasets ≤ 5.1.0, no patched upstream release yet). Inspected pickle files are never executed — inspection is disassembly only.

What it catches

  • load_dataset("pandas", ...) → critical, tagged CVE-2026-57845
  • pickle / dill / cloudpickle / marshal / shelve / joblib loading, pandas.read_pickle
  • torch.load without weights_only=True, numpy.load(..., allow_pickle=True), unsafe yaml.load
  • Pickle files whose REDUCE calls dangerous callables (os.system, subprocess.*, eval, exec…) — critical
  • Pickle files invoking non-standard callables via REDUCE — the exact shape of the published CVE PoC payload — high
  • The pickle stream inside torch .pt / .pth / pytorch_model.bin zip archives

Modes

  • pickle-sentry <path> — AST-scan a codebase and inspect its pickle files
  • pickle-sentry hub <user/repo> [--repo-type model] — scan a Hugging Face Hub repo the same way, before you load anything from it
  • Text / JSON / SARIF output, --fail-on thresholds for CI, --exclude for triage, a composite GitHub Action, and a pre-commit hook

Proof, not promises

  • docs/LIVE-EXAMPLES.md: live scans of huggingface/datasets (exactly one production finding — the CVE sink at pandas.py:56) and scikit-learn
  • docs/USE-CASE.md: scanning the actual published CVE-2026-57845 PoC repository — payload flagged by name, and the PoC's own marker.txt proves it never executed during the scan
  • 21 tests, including a canary test proving a malicious pickle is flagged without being run

Install: pip install pickle-sentry