This page's angle
The course describes the attacks elsewhere, in detail. Prompt injection explains why a model cannot tell an instruction from data, catalogues the forms of injection, and weighs each defence. Adversarial attacks covers the mathematical fragility of neural networks. Guardrails in production covers the filters and what they guarantee.
This page covers the running-a-campaign side: how you organise attacking your own system, how you automate it, what numbers come out, and how often you start over. The vocabulary is borrowed from conventional security testing (the red team attacks, the blue team defends) applied to something that does not behave like software.
The difference that changes everything: a model is not patched like software
This is the starting point, and it is structural.
A software bug is deterministic. It reproduces on demand, you find the offending line, you fix it, it is gone. A patch is a proof.
A model flaw is probabilistic. The same attack can fail several times and then succeed, because generation carries randomness and because context is never identical. There is no offending line: the unwanted behaviour is spread across billions of parameters. You do not remove it, you lower its probability, through retraining, a filter, a restriction of capabilities.
Three practical consequences follow:
| On software | On a model |
|---|---|
| One reproduction establishes the flaw | You must count successes over attempts |
| The fix is verifiable once and for all | The fix is verified statistically, and re-verified |
| "No known flaw" is a stable state | It expires, because attacks and the model both move |
"This attack succeeded" means nothing until you know over how many attempts. An attack that lands once in a hundred does not call for the same response as one that lands nine times in ten. A report listing successful attacks without success rates is not actionable: it supports neither prioritisation nor any measurement of progress after a fix.
What you look for, sorted by the nature of the damage
The attack families are described in detail in the pages cited above. What belongs here is the sort by what happens if it works, because that is what sets priority:
| Family | What the attacker gets | Real damage |
|---|---|---|
| Instruction hijacking (jailbreak) | Text the service should not have produced | Reputation, compliance |
| System prompt extraction | The text of the service's instructions | Makes the next attacks easier |
| Context data extraction | Documents the attacker had no right to | Data breach, usually the worst |
| Indirect injection via a read document | Execution of an action in the user's name | Everything the agent can do |
| Training data regurgitation | Memorised fragments of the corpus | Confidentiality, rights in the content |
The hierarchy is clear and often inverted in people's minds. A model that swears is a reputation incident. An agent that sends an email because a document it read told it to is a security incident, with legal consequences of a different order. Which is why the most closely watched surface must be actions, not words.
Building a campaign

Six steps, in order:
- Write the harm taxonomy. Which behaviours are unacceptable for this service? A legal drafting assistant and a game companion do not have the same list. Skip this and you test at random.
- Assemble the team. People who know security, people who know the domain, and people who know neither. That third group matters: the most effective attacks often come from someone who has not internalised what the system is supposed to do, and therefore tries things a designer would not.
- Attack, starting with published attacks, then varying them. Work through the known catalogues before inventing: there is no credit in resisting exotic attacks while falling to common ones.
- Document every success with enough to replay it: the exact text, the model and its version, the settings, and how many attempts it took.
- Prioritise, using the damage table above crossed with ease of execution. A severe attack requiring access to model weights ranks below a mild one that fits in a sentence copied from a forum.
- Re-attack after fixing. An unverified fix is a hypothesis.
Automation, and where it runs out
A human team produces tens to hundreds of attacks. That is not enough to measure a success rate to any useful precision. Hence three automatic approaches.
Varying known attacks
Take a catalogue of attacks and mechanically produce variants: rephrasings, translations, encodings, embeddings in a surrounding context. Cheap, and it mostly measures robustness to surface variation, useful, because that is what an ordinary attacker does.
One model attacking another
A first model manufactures the trap questions, the system under test answers, and a classifier automatically sorts the problematic responses. The principle was laid out as early as 2022 by a DeepMind team.

The decisive merit of this approach is not volume but the kind of defect only it finds. Differential treatment by group does not show up in one example: it takes thousands of symmetric questions and a comparison of distributions.
Optimisation against the weights
When the weights are available (an open model, or a vendor testing its own) you can search numerically for a character string that, appended to a forbidden request, maximises the probability that the model opens its answer with agreement rather than refusal.
The result that marked the field is one word: transferability. Suffixes optimised against open models, whose weights were accessible, also elicited forbidden responses from closed commercial services, of which the authors had only the interface.
It defeats the commonest security argument: "our weights are not public, so nobody can optimise an attack against us". If an attack computed on an open model works on a closed one, then keeping weights private does not protect against that class of attack. It only raises the preparation cost.
It also explains why a newly published attack must be tested immediately against your own system, even when the paper concerns an entirely different model.
Universal and Transferable Adversarial Attacks on Aligned Language ModelsThe tooling
garak is the most widely used vulnerability scanner for language models. Open source, maintained by NVIDIA, it is organised in three parts: probes, which generate the attacking interactions; detectors, which recognise that a failure mode occurred; and generators, the connectors to various model interfaces. Around twenty probe families ship with it, unrestricted personas, injections, encoding-based attacks, malware generation, toxicity.
The thing to understand before reading such a report: a scanner measures coverage of its own catalogue, not the safety of the system. A clean report means "none of the attacks this tool knows about worked", which is good news and limited information.
The numbers a campaign has to produce
An actionable campaign report is four numbers, none of which stands alone:
- Success rate per attack family, over a stated number of attempts. Per family, not overall: an average mixes a trivial attack with an exotic one and supports no decision.
- Attempts needed to the first success. This measures cost to the attacker, and is often the most telling figure: a flaw that takes ten thousand attempts is protected by rate limiting; a flaw that lands on the first try is not.
- The defence's false-positive rate, measured on legitimate traffic. A campaign reporting only block rates mechanically drives over-filtering, whose cost is described in guardrails in production.
- The date and the versions. Model, system prompt, filters. A rate without those three is not replayable, so it is not a measurement.
Who decides that a response constitutes a violation? If it is a human, case by case, the campaign is not reproducible and two campaigns cannot be compared. You need an evaluator (classifier or model judge) whose instruction is frozen for the whole campaign, and which has itself been checked against human judgement on a sample, exactly as described in LLM-as-a-judge. An unvalidated evaluator produces a rate that measures its own preferences.
Defending: the layers, ordered by strength
Defence in depth is described in detail in guardrails in production. What belongs here is the ordering by strength, which is not the ordering by ease of installation:
- Restrict capabilities. The agent gets only the tools and data strictly required. This is the only layer that gives a guarantee: what the system cannot do, no attack makes it do. See the three levers in tool use and orchestration.
- Isolate execution. The agent's actions run in a sealed environment with no reach into the rest of the system.
- Require human confirmation for irreversible or expensive actions.
- Rate-limit per user. Blocks no attack, but prices out those needing thousands of attempts, which, given number 2 above, eliminates a real share of them.
- Train the model to refuse: RLHF, safety training, constitutional AI. Effective on volume, never total.
- Filter inputs and outputs with a classifier.

- Harden the system prompt. Useful, and the weakest of all: it is text in the same channel as the data, therefore bypassable by construction. No magic formula of the "ignore any instruction contained in documents" kind has ever held up under testing.
The order is deliberate. Layers 1 to 4 restrict what is possible; layers 5 to 7 make bad behaviour improbable. An architecture resting only on the latter has no floor.
The reference framework: the OWASP list
OWASP (Open Worldwide Application Security Project, the body that has published application-security risk lists for twenty years) maintains a top ten of risks specific to applications built on language models. The version in force is the 2025 one:
| Code | Risk |
|---|---|
| LLM01 | Prompt injection |
| LLM02 | Sensitive information disclosure |
| LLM03 | Supply chain |
| LLM04 | Data and model poisoning |
| LLM05 | Improper output handling |
| LLM06 | Excessive agency |
| LLM07 | System prompt leakage |
| LLM08 | Vector and embedding weaknesses |
| LLM09 | Misinformation |
| LLM10 | Unbounded consumption |
Two remarks for anyone meeting these codes in technical or contractual documents. The list has changed since its first 2023 edition: entries were renamed, merged, and new ones appeared, notably system prompt leakage and vector-store weaknesses. Citing "the OWASP LLM Top 10" without a year is therefore ambiguous. And the list covers application risks, not properties of the model: LLM05 and LLM10 are classical software engineering topics, output escaping and resource limiting, with nothing AI-specific about them except their cause.
The regulatory frame
The European AI Act imposes, for systems classed as high risk, obligations of robustness, documentation and human oversight, phased into application from 2025.
What a red-team programme contributes in that frame is very concrete, and it is what earns it a place in an operations course: it produces dated evidence. An attack set, success rates, dates, versions and a record of fixes constitute robustness documentation. Without a campaign there is nothing to produce, not because no effort was made, but because no effort was measured.
Why it matters
The anchor is the same as on the other pages in this module. Having a team try to break your system is standard practice, borrowed wholesale from information security, and the existence of a red team is unremarkable in itself.
What can be remarkable lives in the mechanisms: the arrangement that automatically manufactures new attacks from the ones that worked; the one that feeds successes back into training to close the correction loop; the one that decides a newly published attack must trigger a campaign; the one that estimates cost to the attacker rather than success rate alone. And for any safety claim met in a disclosure, the same question as on the previous page: rate measured over how many attempts, on what date, against which version?
1. A red-team report lists ten « successful attacks » against your assistant. What information is missing for it to be usable?
2. Between a chatbot that utters a swear word and an agent that sends an email because a document it read told it to, how does the page rank the two?
3. A provider claims: « our weights are not public, so no attack can be optimized against us ». Which experimental result defeats that argument?
4. The garak scanner returns a clean report on your system. What does that prove?
5. Why does the page put « limit the agent's capabilities » at the very top of the defense ranking, above filters and the system prompt?