Repository navigation
Releases
ModelSieve v0.3.0: hidden-tool detection
New check: template.injected_tool. It was suggested in the r/LocalLLM discussion of the top-400 study.
A chat template can't make network calls itself; rendering only produces a string. It can quietly add a tool to the system prompt, or tell the model to call one, and an agentic client that executes tool calls then does the exfiltration for it. ModelSieve now flags:
- tool definitions hard-coded in the template's own text: JSON function schemas, and
type fn = (…) => …signatures, including definitions split across many small string constants (vendor style, or an evader's); - instructions to call a specific named tool ("always call
send_report(…"); - HIGH when the hard-coded tool text carries a fixed URL, the exfiltration shape. MEDIUM otherwise, because vendor built-ins match too.
Tools rendered from the caller's own tools list are not flagged.
Measured on the 396 cached repos from the study: 5 findings in 3 unique templates, all MEDIUM, all a documented vendor built-in browser tool (search/open/find). No HIGH in real models.
87 tests; CI and action self-test green.
ModelSieve v0.2.0: GitHub Action, pre-commit hook, SARIF
Integrations: put ModelSieve in front of model files automatically.
GitHub Action
- uses: redveil-industry/modelsieve@v0.2.0
with:
path: models/
fail-on: HIGH
- uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: modelsieve.sarifThe action installs ModelSieve from its own checkout (the tag = the scanner version), passes inputs to the shell only as environment variables, and writes a job summary. It is tested on every push by running against a malicious and a benign fixture.
pre-commit
- repo: https://github.com/redveil-industry/modelsieve
rev: v0.2.0
hooks:
- id: modelsieveRuns only when a commit touches model artifacts or HF/MLX configs.
--sarif FILE
SARIF 2.1.0 output with security-severity for GitHub code scanning. CI validates it against the official OASIS schema.
76 tests; CI green on Python 3.9–3.13.
ModelSieve v0.1.1
False-positive fixes found by scanning the 400 most-downloaded GGUF and MLX repos on Hugging Face (header bytes only).
template.ssti_filter_arg: only dunder or name-mangled names (containing__) count as gadgets. Single-underscore dict keys such as'_order'are no longer CRITICAL.- Big-endian GGUF (s390x builds) is now reported as
gguf.big_endian(LOW, not analysed) instead of CRITICALgguf.malformed. code.import_injectionflags only values that can change the import path (.,/,\, whitespace, non-ASCII). A hyphenatedmodel_typeonly makes the import fail.template.content_triggerlowered to MEDIUM, because vendor reasoning switches (/nothink,detailed thinking on) also match. Single-word identifiers such asARRAYare treated as type checks.- Unknown or fork-local ggml type ids: one aggregated
gguf.unknown_typefinding per file, and the layout checks are skipped (newgguf.layout_unverified, LOW) instead of raising a falsegguf.noncontiguousHIGH.
74 tests; CI green.
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).