AI Red Teaming course · lesson 6 of 26
- 1What Is AI Red Teaming?
- 2Ethics, Authorization, and Rules of Engagement
- 3AI and Machine Learning Basics for Red Teamers
- 4Security Principles and AI Threat Modeling
- 5Build a Safe AI Red Team Test Lab
- 6Jailbreaks and Safety Filter Bypasses
- 7Prompt Injection: Direct and Indirect
- 8Code Injection and Tool Abuse
- 9System Prompt and Data Leakage
- 10Countermeasures for Prompt Attacks
- 11Data Poisoning and Backdoors
- 12Adversarial Examples
- 13Model Extraction and Weight Theft
- 14Model Inversion and Privacy Leaks
- 15Model Manipulation and the AI Supply Chain
- 16AI Infrastructure, Deserialization, and Remote Code Execution
- 17API Authentication and Authorization
- 18Black, Grey, and White Box Testing
- 19Manual, Automated, and Continuous AI Testing
- 20AI Red Teaming Tools, Frameworks, and Datasets
- 21Write Your Own AI Security Test Harness
- 22Report AI Security Findings and Track Fixes
- 23Defense in Depth for AI Systems
- 24Red Teaming LLM Applications and Agents
- 25Disclosure, Law, Careers, and What's Next
- 26Capstone: Red Team a Practice App
After this lesson, you will be able to explain what a jailbreak tests, describe several broad families of bypass attempts without relying on harmful examples, and plan a small measurement exercise using a harmless stand-in. The goal is to assess whether an authorized system follows a clearly stated safety policy. We will use the local HelpDesk Bot lab and a fictional canary as a measurement example, not try to produce dangerous content or test a public model.
What a jailbreak tests
A safety policy defines what a system should and should not do in a particular use. For a support assistant, the policy might allow ordinary help questions but prohibit revealing private records or performing an unapproved action. A safety filter is a control that checks input or output and can flag, block, or route content for additional review. Some products combine filters with model training, system instructions, application rules, and human review.
A jailbreak is an input or conversation designed to get a model to produce an output that its safety policy says it should refuse. NIST describes it as a prompting attack intended to circumvent restrictions on model outputs. The important part is the policy violation, not whether the input looks dramatic or clever. If a model produces disallowed output after an ordinary request, the safety control has still failed its intended behavior. If it refuses a harmless request that the policy allows, that is a different problem called an over-refusal.
Jailbreak testing asks a narrow question: can the model or application be led across a defined safety boundary? It does not, by itself, test account permissions, infrastructure, or whether retrieved information is authorized. Those are separate security questions from the lesson on threat modeling. Jailbreaks and prompt injection can overlap, but they are not identical. A jailbreak seeks to bypass the model's safety behavior. Prompt injection, which we cover next, is a broader attempt to redirect the model by supplying conflicting instructions, including through documents and tool output.

The diagram shows why testing one filter does not tell you whether the whole product is safe. An input filter may miss a request whose meaning is conveyed indirectly. An output filter may fail to recognize a new form of content. A refusal from the model may still be followed by an unsafe tool action if the application gives the model too much authority. The question is not whether a box exists in the architecture. It is whether the intended control works for the use case and what happens if it does not.
Why safety controls can miss a request
Generative models interpret context, infer intent, and produce responses based on patterns learned during training. Safety behavior is shaped by training and additional controls, but it is not a formal guarantee that every possible wording will be handled as intended. NIST notes that a system may still produce a harmful recommendation in response to a less explicit or novel prompt even when it restricts some outputs. A filter can be useful and still miss cases outside the examples or signals it recognizes.
Several broad technique families help a tester organize coverage. These are descriptions of what to examine, not recipes or ready-to-use prompts:
| Family | What changes in the test | Safe question for a reviewer |
|---|---|---|
| Role-play framing | The request is presented as a fictional role or changed identity. | Does the same policy apply when the model is asked to act in a different role? |
| Obfuscation or transformation | The same benign test intent is represented with a different spelling, format, or language. | Does the control recognize meaning, or only a narrow surface pattern? |
| Multi-turn drift | A conversation gradually moves from an allowed task toward a disallowed one. | Does the system reassess the full conversation as the request changes? |
| Competing objectives | A request creates tension between being helpful and following a safety rule. | Does the policy remain clear when instructions or goals conflict? |
The families can combine. A conversation might shift roles across several turns, or express the same request in another language. A test report should describe the kind of variation and the observed policy result without publishing harmful material. For this course, any protected output is replaced by a fake canary or a harmless marker word. The purpose is to learn whether a boundary holds, not to generate the content that a real safety policy blocks.
The model's answer can also vary between runs. A non-deterministic system may respond differently to the same input because generation includes variation or because the surrounding service changes context. One refusal therefore does not establish that every similar request will be refused. Record the model and application version, policy version, relevant settings, and conversation state so another reviewer knows what was evaluated.
Choose a harmless stand-in
An effective safety test needs a clear rule and a safe way to recognize a violation. Do not choose a dangerous output as the test goal. Create a benign stand-in that represents the boundary while avoiding the harm itself.
For the fictional HelpDesk Bot, use this course policy for a test design:
The assistant may answer ordinary support questions. It must not reveal the planted synthetic canary
LAB-CANARY-7Q4Munless the exercise explicitly tests the canary path.
This rule is deliberately artificial. The value is fake, and an output containing it is easy to detect. A test can ask whether the assistant returns that marker under a set of controlled, policy-relevant variations. It does not need to ask for a real password, personal record, or harmful instructions. You may also use a made-up word as a canary when the system under test must not reveal a particular internal marker.
The Lesson 5 stub is a fixture, not a safety-filter evaluation target. It intentionally returns the canary when it sees an exact marker, and it has no general model, refusal behavior, or filter. You can use it to see how a canary appears in a response and log, but its result cannot tell you whether an LLM's safety controls resist jailbreaks. Do not report its scripted behavior as a jailbreak finding. A later model-backed or separately simulated target would need an explicit policy and a documented safety control before this measurement could say anything about those controls.
Before testing another authorized system, confirm that the policy owner agrees on the harmless stand-in, the expected refusal, the allowed requests, the test account, and the environment. Follow the authorization and rules-of-engagement guidance. Permission for one target does not transfer to a model provider, production environment, or another user's account.
Measure a bypass rate carefully
A bypass rate is the proportion of valid test trials in which the system violates the safety rule being measured. In a small, scoped exercise, define one trial as a complete conversation or request sequence that tests the policy once. For a multi-turn case, count the whole trajectory as one trial, not every message as a separate success or failure.
bypass rate = policy-violating trials ÷ valid in-scope trials × 100%
Suppose a team planned twelve harmless trajectories against an authorized test target. If three produced the prohibited synthetic marker, the observed bypass rate would be 3 ÷ 12 × 100 = 25%. That number describes only those twelve trials, that policy, and that system version. It is not a universal score or a guarantee about future behavior. The example is illustrative; no model-backed test was run while writing this lesson.

Build a measurement plan in this order:
- Write the policy in observable terms. State what the system may do, what it must refuse, and what output counts as a violation. Avoid a vague objective such as “be safe.”
- Select a harmless marker. Use a fabricated canary or neutral word that cannot expose a real person or enable harm.
- Choose a small set of variations. Cover the technique families that matter to the policy without writing harmful payloads. Keep each case inside the authorization and agreed request limits.
- Set up the test conditions. Record the model, application, policy version, settings, account, date, and conversation reset procedure.
- Run each trial and preserve minimal evidence. Use synthetic input and record the input category, output classification, and relevant request identifier. Do not retain unnecessary content.
- Grade the result consistently. Apply a written rubric, use a deterministic marker check where appropriate, and ask a qualified reviewer to resolve ambiguous cases.
- Report counts and limits. Include the numerator, denominator, excluded technical failures, over-refusals, and important gaps in coverage.
Do not silently discard a failed request, timeout, or ambiguous output. Define in advance whether it counts as a valid trial, an inconclusive result, or an infrastructure failure, and show the counts separately. If the service is unstable, fix or document the test conditions before comparing results. Otherwise a rate change could reflect an outage or configuration difference rather than a safety improvement.
Keep a second measure for false refusals: safe requests that the policy permits but the system blocks or mishandles. A control that refuses every request could have a zero bypass rate and still be unusable. Include harmless allowed questions in the test set, then record correct completions and false refusals alongside policy violations. The product team needs both measures to understand the trade-off between blocking unsafe output and serving legitimate users.
Interpret the result without overclaiming
A bypass rate is a compact measurement, not a complete safety evaluation. A result depends on the test set, policy definition, sample size, system version, conversation state, and grading quality. A small sample can help locate a problem, but it cannot represent every user, language, context, or future model update. If the model is stochastic, repeated runs may be useful, but set the number of runs before seeing the results and report the number honestly.
For example, a report might say: “On version X, 3 of 12 valid synthetic canary trials violated the stated policy; 2 allowed support questions were incorrectly refused. The sample covered four conceptual variation families and used one test account. This is a preliminary result, not a broad estimate of production risk.” That wording gives a reader enough context to interpret the numbers and identify what to test next.
Do not use the score to rank products unless the targets, policies, cases, run conditions, and graders are comparable. Different providers may have different use policies, system prompts, moderation layers, and tool access. A percentage without that context can create false confidence or an unfair comparison. Preserve the case-level evidence needed to reproduce a result inside the authorized environment, while minimizing how much sensitive or disallowed text is copied into reports.
A filter is not a security boundary
A safety filter can reduce the chance of a policy violation, but it should not be the only control protecting a system. It may miss a novel or ambiguous input, and the model may produce an unexpected response. Design the application so a failure does not automatically become a serious incident.
- Do not put passwords, API keys, private ticket records, or other unnecessary secrets into a prompt just because a filter is present.
- Enforce identity, authorization, and record access in application code and data services, not by asking the model to decide who may see a record.
- Give tools only the permissions needed for their task. Keep high-impact actions behind a separate confirmation or approval step.
- Treat model output as untrusted input before another program, database, or tool uses it.
- Log enough to investigate test outcomes, while following the agreed data minimization and retention rules.
- Re-test after model, prompt, policy, filter, or application changes, and monitor for regressions in authorized use.
These controls address impact when a model response is wrong. A refusal layer may still be valuable; the point is to pair it with controls that do not depend on the model correctly policing itself on every turn. The OWASP GenAI Top 10 for LLM Applications 2026 and MITRE ATLAS provide broader risk references for application and model behavior. The current ATLAS knowledge base includes an LLM Jailbreak technique. Use those frameworks to organize a review, not as proof that a particular filter is effective.
Mistakes beginners make
- Using harmful content as a test goal. Replace it with a canary or harmless marker that shows whether a boundary failed.
- Treating one refusal as proof. Measure a planned set of cases, record the conditions, and state the coverage limits.
- Calling every unusual answer a jailbreak. Compare the output with the written policy and distinguish a policy violation from an allowed answer or an over-refusal.
- Counting each message in a multi-turn test separately. Grade the full conversation trajectory as one trial when the policy outcome depends on context.
- Reporting a percentage without its counts. Include the number of failures, valid trials, exclusions, allowed-task errors, and test conditions.
- Relying on the filter to protect data or tools. Enforce permissions and action limits in the surrounding application.
- Testing a provider or public model without approval. The local lab is the exercise target; any other system needs its own authorization and rules.
Recap and try it yourself
A jailbreak test checks whether an authorized model or application can be led to violate a clearly stated safety policy. Role-play framing, obfuscation, multi-turn drift, and conflicting objectives are broad coverage categories, not instructions for producing harmful content. Use a synthetic canary or neutral marker, define a grading rubric, and report violations alongside false refusals and sample limits. Filters can reduce risk, but application-level permissions, least privilege, validation, and human approval limit harm if a model response is unsafe.
Try it: write a one-sentence policy for the fictional HelpDesk Bot, choose a harmless marker that would demonstrate a violation, and define what a safe refusal and a false refusal look like. Sketch twelve conceptual test trajectories across the four variation families in the table, without writing any harmful request text. Decide how you would count valid trials and record results. Do not send those tests to a live model or service. In the next lesson, you will study direct and indirect prompt injection, a broader class of input that can redirect a model's behavior.
Sources checked on 5 November 2026: NIST's jailbreak glossary entry defines the term as an attack intended to circumvent model-output restrictions. NIST's Generative AI Profile describes the risk of restrictions failing on less-explicit or novel prompts. The OWASP jailbreak glossary informs the concept-level families and defense limits. MITRE ATLAS includes AML.T0054, LLM Jailbreak; its 2026 OWASP GenAI Top 10 provides broader application-risk context. Examples and measurements in this lesson are teaching aids; no live model was tested.