Repository navigation
ModelSieve v0.1.0
First public release of ModelSieve: a static security scanner for GGUF and Hugging Face / MLX model artifacts. It parses model files and never loads them.
Install
pipx install modelsieve
pipx inject modelsieve numpy # optional: enables --deep weight checksWhat it checks
- Chat templates (Jinja2 AST, never rendered): SSTI sandbox-escape gadgets (
__class__,|attr,str.formatreferences; CVE-2024-34359 / CVE-2024-56326 / CVE-2025-27516 patterns), one-hop{% set %}indirection, trigger-word branches on user content, hard-coded instructions, invisible/bidi/tag-unicode smuggling (decoded), divergent template sources, and baseline diff against an original model. - Containers: bounded GGUF and safetensors parsers for OOB offsets, integer-overflow counts, duplicate keys, overlaps, hidden gaps and trailing bytes, and llama.cpp layout differentials.
- Code paths: pickle imports across protocols 0–5 (never unpickled),
auto_map, mlx-lmmodel_fileand import hooks, symlink escapes, tokenizer rewrite rules. - Weights (
--deep): NaN/Inf, all-zero tensors, sibling-layer outliers, HF cache blob sha256 verification.
Output: text or --json. Exit codes: 0 = clean at threshold, 1 = findings, 2 = scan error. The verdict always lists what was not checked: static scanning cannot prove the absence of trained-in backdoors.
Quality
72 tests; CI on Python 3.10–3.13 (Ubuntu + macOS) and 3.9 (macOS); SHA-pinned Actions; published to PyPI via Trusted Publishing (no stored token).