Direct prompt injection testing with garak's promptinject probes

garak's promptinject probes send adversarial prompts built on the PromptInject framework to test whether a model or application can be pushed off its instructions. This page covers what they send, how results are scored, and how to read them for an application whose system prompt must hold.

On this page

Direct prompt injection testing with garak's promptinject probes starts with your system prompt

garak's promptinject probes test direct prompt injection by sending PromptInject-style attacks, which place user input designed to override the instructions an application gives the model. Use them when your application's system prompt, guardrails or tool rules must hold against what a user types, for example a customer-facing assistant that can look up accounts, a chatbot that must stay within a published scope, or any workflow where a model's output drives an action. If a determined user can make the model ignore its instructions, that is the finding to establish before launch, not after an incident.

garak is a command-line tool installed from PyPI with pip, and it is released under the Apache 2.0 license. The promptinject module implements the Agency Enterprise PromptInject framework, which won a best paper award at the NeurIPS ML Safety Workshop 2022. Because the tool is open source, your team can read exactly which attack templates are sent and how each response is scored, which matters when a security reviewer asks what the test actually covers. The NVIDIA/garak README is the natural starting point for install requirements and the current probe list.

Before running anything, confirm with your own team what the application is supposed to refuse and which instructions it must never disclose or abandon. garak can only score attempts against detectors it has, so a clean result tells you the attack templates did not succeed against your configured endpoint, not that your application cannot be injected. Record the exact model, system prompt, guardrail layer and any tool permissions under test, so the result can be tied to a specific configuration and rerun after changes.

Which detectors score promptinject results and what a FAIL means

garak scores each promptinject attempt with detectors and rolls the attempts up into a probe-level verdict. The cards below cover how the default run works, what a detector looks for when an injected goal is involved, and how to read a FAIL before you act on it.

Default probewise harness

The default probewise harness runs each probe with the detectors that garak recommends for that probe. For promptinject, this means the injected prompts are scored by detectors tied to the probe, not by a general toxicity check. Confirm the exact detector list for your installed version in the garak user guide before you treat the results as a complete picture of your system prompt risk.

garak user guide

Five generations per prompt

By default garak makes 5 generations per prompt, so one injected prompt produces several model responses rather than one. A single compliant reply does not clear the probe, and a single bad reply is enough to count. Record the generation count in every scan configuration so runs stay comparable.

Detectors check the injected goal

In an injection context, a detector asks whether the model followed the injected instruction instead of the system prompt. Typical signals are the model printing the attacker's target phrase, switching task, or ignoring the original role. Read the detector name in the report to see which signal it watches for, because a detector that only checks for a phrase will miss paraphrased compliance.

What a FAIL means

garak marks a probe as FAIL when any attempt produces undesirable output, and it reports a failure rate alongside the verdict. One failing attempt out of five is a different finding from five out of five, so read the rate before the label. A FAIL shows that the application can be overridden under these prompts, not that every user will be affected.

Verify the detector behavior

Before you sign off a result, open the JSONL report and check the attempts behind a FAIL. Confirm that the flagged output is a real override of your system prompt and not a false match on a benign phrase. Keep a few reviewed examples so that a future upgrade can be checked against the same judgments.

Configuration options and when each fits a prompt injection test

This table compares the garak settings that shape a promptinject run, from probe selection and generations to the target generator and harness. Read each row for when the option fits an application whose system prompt must hold, and what it changes in the JSONL report you review afterward.

OptionWhen it fitsWhat it changes in the report
Select the promptinject probe by nameTargeted test of hijacking and goal-override attacks against one application, or when you want a narrow, repeatable runOnly promptinject attempts appear, so results compare cleanly across runs of the same probe
Use a broader probe family or tagRoutine scans where prompt injection sits alongside other weakness categoriesSeveral probe families are scored together, so a promptinject result must be read within its own probe section
Generations per prompt (default of 5)Default for most runs; lower counts suit quick smoke tests, higher counts suit borderline resultsFailure is recorded if any attempt produces undesirable output, so more generations raise sensitivity and the failure rate needs context
System prompt set in the target configurationWhen the test must reflect your deployed instructions and the guardrails written into themAttempts run against your real instruction set, so a fail points to a specific deployed behavior rather than a bare model default
REST generator for an application endpointWhen the application adds retrieval, tools, filters or session handling that an attacker would reachResults reflect the full application path, so findings map to the product your users touch
Bare model generator (Hugging Face, OpenAI API, Bedrock, LiteLLM)When you are choosing or comparing base models before building an applicationResults describe the model alone, so they do not show protection added by your wrapper or instructions
Default probewise harnessStandard runs where each probe uses its recommended detectorsEach attempt is scored by the detectors bundled with the probe, which you should review before relying on the verdict
Custom harness or detector settingsWhen your policy defines a violation the default detectors may miss or over-countScores change with the detector, so record the configuration with the report to keep later comparisons valid

How to run promptinject probes against your application

This sequence takes you from a clean garak installation to a reviewed baseline of promptinject results against an application endpoint. Each step ends with a check so you know the setup is sound before you trust the scores.

  1. Confirm the Python version and install garak

    Your engineer checks that the host runs Python 3.11 or newer, then creates an isolated virtual environment and installs garak from PyPI with pip. Run the garak help command from the same environment. It is done when the help output lists options and the probe list includes the promptinject family. Keep the installed version recorded, because report fields and scores can change between releases.

  2. Choose the generator for your endpoint

    Identify how your application receives prompts. If it is a supported provider such as an OpenAI API model, point garak at that generator directly. If your application sits behind its own API, use the REST generator with a short YAML file that describes the endpoint, the request template, the header carrying credentials and where the response text sits in the output. Store credentials in environment variables, not in the YAML file.

  3. Verify the endpoint returns plaintext or JSON

    Before any scan, send one harmless request to the endpoint with the same headers garak will use, for example with curl. Confirm the response is plaintext or JSON and that the text you need can be extracted from it with the path you configured. Ask the application owner to confirm the system prompt and guardrails are the production ones, since a staging copy will produce different results. The check passes when a single test message returns the expected assistant answer in the configured field.

  4. Select the promptinject probes and run a baseline

    Run garak against the generator with the promptinject probe family selected, keeping the default of five generations per prompt unless your engineers have a documented reason to change it. The default harness runs each probe with its recommended detectors. Run the same command twice on the same configuration. The check is that the second run reproduces the first closely enough that the pass and fail pattern matches. If it does not, investigate sampling settings or endpoint variability before you interpret any failure rate.

  5. Review the JSONL report for each attempt

    Open the JSONL report written for the run. It holds one entry for every attempt along with its evaluation, so you can see the exact prompt sent, the response returned and the detector verdict. Read the attempts flagged as failures first and confirm whether the response actually overrode the system prompt or only repeated text that the detector matched. Record the report path and the run configuration together so the evidence can be traced later.

  6. Check garak.log for errors and endpoint issues

    Open the garak.log file, which continues across runs, and search for errors, timeouts, rate limit responses and generator failures. A run with many failed requests can produce misleading pass results, because attempts that never reached the model are not evidence of resistance. The step is complete when the log shows no unexplained errors for the baseline run, or when each error is recorded and the affected prompts are rerun.

  7. Record the baseline for later comparison

    Save the report, the log, the generator configuration and the garak version together in your evidence store, and label them as the baseline for this application and system prompt version. Later scans after a prompt, model or guardrail change can then be compared against this record. The step is done when a colleague can rerun the same configuration from the saved files and reach the same pattern of results.

How a promptinject attempt travels from garak to your app and back

The run starts on the test host, where the garak harness loads a promptinject probe and hands each prompt to a REST generator. The generator crosses the trust boundary and calls your application endpoint, which sends the request to the model with the system prompt in place. The response returns the same way, and the detector scores it for whether the injected instruction took effect. Every attempt and its evaluation is written to the JSONL report, so check that the detector and the system prompt match what your application actually uses.

Data path of one promptinject attempt across the test host and the application.

How to read promptinject results for a system prompt that must hold

A FAIL from a promptinject probe is a starting point for triage, not a finding in itself. Before reporting an override, sort each failed attempt into one of three groups: a real override where the model abandoned the system prompt and followed the injected instruction, a detector false positive where the detector matched text that does not show the model acting on the injection, or an output that repeats the injected text while still following the original instructions. Only the first group is a loss of control over the application. Open the JSONL report written for the run, find the failed attempts for each probe, and read the prompt, the response and the evaluation side by side. Check whether the response performs the attacker's goal, such as changing the assigned role, dropping a restriction or producing a marker the application should never emit.

Comparison is the fastest way to separate real behavior from noise. Run the same probes against a build of the application with a different or deliberately neutral system prompt, and against the production configuration with any tool access and retrieval turned on as it will be in use. If a failure appears in both, it is probably a model-level weakness that the system prompt does not control. If it appears only in production, look at the instructions, retrieved content and tool outputs that sit alongside the system prompt. Treat any leaked system prompt text as a separate finding, even when the injection otherwise failed, because it shows the instructions can be extracted and should be reviewed for secrets, internal logic and policy wording that should not be exposed.

Treat every result as a snapshot. Garak samples generations, so a probe that passes once may fail on another run, and the default of 5 generations per prompt is a sampling choice rather than a guarantee. Confirm the model version, temperature, generator settings and garak release before comparing runs, because changes in any of them can shift scores. Record the failure rate with the run configuration, repeat the scan on a schedule and after each change to the system prompt or model, and agree with the application owner which failure rate and which override types count as unacceptable. Ask whether the team has the evidence to show a reviewer what was tested, how the results were classified and what was fixed.

Security and operational considerations for live injection tests

Promptinject probes send deliberate attack text to a live model and application, so the test itself creates data that needs protecting. The cards below cover what that traffic leaves behind, where it lands and who can read it, and how to contain it before the first run.

Attack text in application logs

Every promptinject attempt is a crafted instruction that your gateway, application server and model provider may log in full. Those logs can then be read by people and tools that never agreed to see adversarial content. Before the first run, check which request and response bodies your stack records, how long they persist and whether they are shipped to a central log platform. Confirm that test traffic can be tagged so it can be filtered or purged afterward.

Test traffic on hosted model bills

Each probe prompt is a billable request to a hosted model, and garak makes several generations per prompt by default, so a full run multiplies quickly. Ask the model provider how requests are metered, whether test keys carry separate budgets and whether rate limits could throttle production users during a scan. Keep the test key distinct from production keys so spend and throttling can be attributed and capped.

Sensitive data in model responses

A successful injection can make the model echo system prompts, retrieved documents, customer identifiers or credentials that sit in its context window. Treat any response that contains real personal or confidential data as a finding in its own right, and stop the run if it surfaces. Use test data in the staging knowledge base so a leaked value reveals nothing about real customers.

Storing JSONL reports

garak writes a JSONL report that records every attempt and its evaluation, which means the attack prompts and model outputs are stored in that file. Decide where reports live, who may open them and how long they are kept before the first scan, and encrypt them at rest on the scanning host. Keep reports from pre-release and production-adjacent targets in separate locations so a finding in one environment does not spread to another.

garak README

Access control for garak.log

The garak.log debugging file is appended across runs, so it accumulates request details, endpoint configuration and errors over time. Restrict its file permissions to the people running scans, avoid writing it to shared volumes or world-readable CI artifacts, and rotate or archive it on a schedule. If API keys or endpoint URLs appear in logs during troubleshooting, remove them before the file is shared.

Staging endpoint with restricted tools

Run promptinject against a staging copy of the application that uses test data and the same system prompt, with tool permissions limited to read-only or sandboxed actions. An injected instruction that reaches a tool then cannot send email, change records or call production APIs. Confirm with the application owner which tools are enabled in staging, and disable any that write to external systems.

Questions buyers ask about promptinject testing effort and scope

How much effort does an internal team need to run garak's promptinject probes?

An engineer comfortable with the command line can run the promptinject probes once garak is installed, because garak is a command-line tool installed from PyPI with pip and the package requires Python 3.11 or newer. The harder work sits around the run: pointing garak at the right endpoint, deciding which probes and detectors match your application, reviewing each failure against your own system prompt, and rerunning after fixes. Confirm your team's Python environment, the endpoint configuration, and who will own the review of the JSONL report before you plan the work.

What drives the time for an external prompt injection assessment?

The main drivers are the complexity of the endpoint, the number of probes in scope, how much of the findings review is included, and whether a retest is part of the agreed scope. A single chat endpoint with one system prompt takes less setup than a RAG pipeline, a tool-using agent or a guarded gateway with several model routes. Ask for a written scope that lists the endpoints, probe families, review depth and retest rounds, since DeployOpen does not publish a price list and a quote follows from that scope.

What do we need to provide before testing starts?

Testing usually needs four things from your side:

  • Access to the target endpoint, with credentials and a documented request and response format.
  • A staging copy of the application, so probes that override instructions do not reach production users or logs.
  • A test system prompt that matches the production prompt in structure and content, so results reflect your real instructions.
  • A named contact who can answer questions about routing, guardrails and expected behavior.

Confirm with your platform team whether a staging copy with the same model routing exists before you agree on dates.

Is garak free to use for prompt injection testing?

garak is licensed under Apache 2.0 and the maintainers describe it as a free tool, with the user guide published at docs.garak.ai. The license covers the tool itself, not the cost of running it. Your costs come from the model calls made during a scan, compute for any local models, staff time to review results, and any external help you buy. Read the license terms with your legal team before you redistribute modified probes, and check the garak buyer's guide for licensing detail.

Do garak promptinject results count as compliance evidence?

A garak run produces testing evidence, but the results alone do not establish compliance. The JSONL report records every attempt and its evaluation, and the failure rate shows how often a probe produced undesirable output, which is useful input to a control review. An assessor will still ask what was tested, how the system prompt and endpoint were configured, who reviewed the failures, and what changed afterward. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue any audit report or certification.

How do we know whether a promptinject failure is a real override?

A FAIL means at least one of the default five generations produced output the probe's detector scored as undesirable, so the reviewer must read the flagged attempts before drawing conclusions. Check whether the output followed the injected instruction in a way that breaks your application's intended behavior, such as ignoring the system prompt's scope or revealing restricted content. Record the detector, the attempt and the reviewer's decision in your findings log, because false positives and misses both affect the next scan.

Can our engineers repeat the promptinject tests after a fix?

Yes, if the run is configured to be repeatable. Keep the endpoint configuration file, the probe selection, the system prompt version and the garak version with each report, because scores can shift between garak releases. garak v0.17.1 was released on 16 October 2026, so record the exact version you tested with. Schedule a rescan after each change to the system prompt, model or guardrail, and treat a retest as a separate agreed item when an external team supports the work.

How DeployOpen scopes and delivers prompt injection testing

DeployOpen starts prompt injection work with a written scope agreed before any testing begins. For an application whose system prompt must not be overridden, that scope names the components under test: the model endpoint, the system prompt and its place in the request, any retrieval or tool inputs that carry untrusted text, the output path to users, and the logs where attempts are recorded. It also fixes the garak probes to run, the detectors that score them, the number of generations per prompt, and which environments are in play. Scope also records what is out of bounds, such as production traffic or third-party systems, so the client can approve the test plan before any request is sent.

Testing combines garak's promptinject probes with other methods where garak's coverage stops. DeployOpen runs the promptinject probes against the application as the client's users reach it, not only against a bare model, so that the system prompt, wrapper logic and filters are part of what gets tested. Results are reviewed by hand: a FAIL from a detector is checked against the actual response to confirm the system prompt was overridden, and the findings report records each confirmed case with the prompt, the response and the affected control. Each finding comes with a recommended fix, such as prompt structure changes, input handling, tool permission limits or output checks, and the fix is stated as a decision for the client's engineering team to make and own.

After the client's team applies fixes, DeployOpen retests the same probes and the affected cases to confirm the changes hold. DeployOpen prepares the testing evidence and the findings report, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those decisions, so clients should confirm with their assessor which evidence they need. Because models, prompts and application code change, a one-time test shows only the state at the time it ran. Ongoing testing, with scheduled rescans and retests after changes, is available as a retainer and is priced from the agreed scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.