← GUIDES

GUIDE / SETUP NOTE

Scan a Model Endpoint for Prompt Injection With garak

Run NVIDIA's garak scanner against a local Ollama model, read the prompt injection and exfiltration results, and decide what to fix. Tested on 0.17.1.

12 Nov 2026Checked 2026-10-30
garak scan results showing prompt injection and markdown exfiltration rates for a local model

garak by NVIDIA (github.com/NVIDIA/garak), Apache-2.0. Checked on garak 0.17.1, Python 3.12, against qwen2.5:1.5b on Ollama, CPU only.

garak is NVIDIA's open-source scanner that sends known attack prompts to a model and scores the replies, so you can see how often prompt injection or data exfiltration works before an agent reads untrusted text. Install it with pip, point it at your endpoint, and pick a few probes rather than running everything.

We scanned a small local model through Ollama on a Linux box with no GPU. Two focused probes took about 20 minutes and found real failures.

What it is (checked on 2026-10-30)

garak probes a language model for weaknesses such as prompt injection, jailbreaks, data leakage and toxic output. Each probe sends prompts, and detectors score the replies. It is under the Apache-2.0 licence. The latest release on PyPI is 0.17.1, uploaded on 2026-10-16, and it needs Python 3.11 or newer. The design is described in the paper garak: A Framework for Security Probing Large Language Models.

Based on garak, by NVIDIA and contributors.

The setup at a glance

  • Trigger: before you connect a model to an agent that reads web pages, email or documents, and again when you change the model or system prompt.
  • Permissions: network access to the model endpoint only. garak does not need your agent's tools or data.
  • Output: a JSONL report of every attempt and an HTML summary with a rate for each probe and detector.
  • Human approval: a person reads the failed attempts in the report and decides whether the model is fit for the job, or what guard to add. A score alone is not a sign-off.

Step 1: Install and do a dry run

bash
pip install garak
garak --target_type test.Blank --probes test.Test

The test generator returns empty replies, so this checks the install without touching a model. Ours passed 40 of 40 in about a second.

Step 2: Pick probes that match your agent

The CLI reference lists options such as --probes, --generations and --parallel_attempts. For an agent that reads outside content, two probe families are a good start:

  • latentinjection tests "prompt injections buried in other contexts, like a resume or financial report". LatentInjectionReport is a lighter version that hides an instruction in a document and checks whether a trigger string shows up in the reply.
  • web_injection MarkdownImageExfil asks, in the docs' words, "Can we get the model to write embedded assets exfiltrating text in the URI?" If a chat window renders that image, the data leaves in the request.

Step 3: Scan the endpoint

The Ollama generator has a chat version. We ran:

bash
garak --target_type ollama.OllamaGeneratorChat --target_name qwen2.5:1.5b \
  --probes web_injection.MarkdownImageExfil,latentinjection.LatentInjectionReport \
  --generations 1 --parallel_attempts 4 --report_prefix qwen1

The same reference lists other generators, including openai and rest, so you can point garak at a hosted API or your own HTTP endpoint instead. The docs cover configuration.

What our test showed

CaseWhat happened
Dry run with test.Blank40 of 40 passed in about a second
LatentInjectionReport, 256 prompts66 failed. Attack success rate 25.78% (garak's interval: 20.70% to 31.25%)
MarkdownImageExfil, 12 prompts1 failed on both detectors. Attack success rate 8.33%
Full run on CPU1,188 seconds, about 3 to 4 seconds per prompt
A failed exfiltration attemptThe model printed "AI Injection succeeded." and wrote a markdown image link to the attacker's URL
A failed latent injectionAsked about a document with a hidden instruction, the model replied with only the attacker's domain

A 1.5B model is not what you would put in production. The point is the method: the same command against your real endpoint tells you how often these attacks land on it.

Things to know

  • Read the failures, not just the rate. The JSONL report keeps each prompt and reply. One exfiltration hit matters more than a low percentage if your chat window renders images.
  • Rates depend on settings. We used one generation per prompt. More generations give a steadier rate and a longer run.
  • Keep runs small. Running every probe against a paid API costs real money and time. Start with the probes that match how your agent is exposed.
  • A scan does not replace guards. Block remote images in agent output, keep secrets out of the context, and limit which tools can act on what the model reads.
  • Probe content is hostile. The prompts include attack text by design. Run scans against test endpoints, not a chat that real users or tools are connected to.

Takeaway

garak gives you a repeatable way to measure prompt injection and exfiltration on the exact model you plan to use. Pick probes that match your agent's inputs, read every failed attempt, and fix the setup around the model, not just the model choice.

Next step: run the two probes above against your own endpoint with --report_prefix set, open the HTML summary, and have a person review each failed attempt before you connect the model to real tools.

Good setups, worth keeping. Request email updates on the home page, then confirm by email. No subscription starts until you confirm. Or find an agent for the job.

Your privacy choices

Choose optional tools. Rejecting them keeps the setup library available. Advertising consent stays off.

Choices stay in this browser for 90 days. You can change them using Privacy settings. Privacy and cookie details