How to use from
llama.cpp
# Gated model: Login with a HF token with gated access permission
hf auth login
Install from brew
brew install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf Rushit21/llamafile-chat-template-poc
# Run inference directly in the terminal:
llama-cli -hf Rushit21/llamafile-chat-template-poc
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf Rushit21/llamafile-chat-template-poc
# Run inference directly in the terminal:
llama-cli -hf Rushit21/llamafile-chat-template-poc
Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf Rushit21/llamafile-chat-template-poc
# Run inference directly in the terminal:
./llama-cli -hf Rushit21/llamafile-chat-template-poc
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf Rushit21/llamafile-chat-template-poc
# Run inference directly in the terminal:
./build/bin/llama-cli -hf Rushit21/llamafile-chat-template-poc
Use Docker
docker model run hf.co/Rushit21/llamafile-chat-template-poc
Quick Links

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

llamafile Inference-Time Backdoor via chat_template β€” PoC

Security research proof-of-concept for a bug bounty submission on huntr.com.

What this is

poc_chat_template_backdoor_v2.gguf is a GGUF model file that demonstrates an inference-time backdoor via a malicious tokenizer.chat_template metadata field in llamafile v0.10.0.

When loaded with llamafile, the embedded Jinja-compatible template silently injects a hidden system instruction into the model's prompt whenever any user message in the conversation contains the trigger word activate. The model behaves completely normally for all other inputs.

Reproduction

pip install gguf jinja2 numpy
python poc_verify.py   # all 7 checks pass in ~1 second

To test with a real llamafile binary:

# Positive control β€” injection fires
./llamafile -m poc_chat_template_backdoor_v2.gguf --cli --verbose-prompt \
  -p "please activate the assistant"

# Negative control β€” clean
./llamafile -m poc_chat_template_backdoor_v2.gguf --cli --verbose-prompt \
  -p "what is the capital of France?"

Scanner bypass

  • ProtectAI ModelScan v0.8.8: no .gguf handler β†’ full bypass
  • ModelAudit: no Jinja2 gadget detection β†’ bypass
  • PickleScan: not a pickle file β†’ bypass
  • 24-keyword static ACE signature scan: 0 hits

Affected

llamafile v0.10.0 (all versions with Jinja2 support, since llama.cpp PR #18462)

Responsible disclosure

Submitted to huntr.com Model Format Vulnerability program.

Downloads last month
-
GGUF
Model size
64 params
Architecture
llama
Hardware compatibility
Log In to add your hardware

We're not able to determine the quantization variants.

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support