Zulia Shavaeva← Back to Zulia

Learn / AI red teaming and adversarial testing

AI red teaming and adversarial testing

Probing AI systems, especially LLMs, for exploitable weaknesses using adversary tactics and structured attack testing.

Before the exercises: Know web security and Python. Obtain explicit test permission and define an authorised target before running scanners or attack automation. Start with Step 0 if needed.

Researched on 2026-09-26 with AI assistance. Links and summaries can change; verify details with the original source. Not yet reviewed by a person.

What it is

AI red teaming is adversarial probing of a generative AI system to find failures an attacker could cause on purpose. The Microsoft team that red teamed over 100 generative AI products describes it as covering both security flaws and responsible AI harms, and argues the work of securing AI systems is never complete.2

The target is the whole system, not the model alone. OWASP's GenAI Red Teaming Guide organises the work into four areas: model evaluation, implementation testing, infrastructure assessment and runtime behaviour analysis.9

It is not the same as safety benchmarking. Benchmarks score a model on a fixed test set, while red teaming looks for new attacks under adversarial pressure, which is why live competitions still surface attacks that static benchmarks miss.26

Findings are usually written up against a shared vocabulary. MITRE ATLAS catalogues adversary tactics and techniques against AI systems and grew out of the Adversarial ML Threat Matrix, published by MITRE, Microsoft and 16 other organisations.110

In the job-posting sample

Counts describe 48 postings collected on 24 September 2026. Small role samples do not establish market-wide requirements or explain employer decisions.

23 of the 48 sampled postings mention red teaming, including all 9 red-team postings and all 4 research postings in this dataset.P

The skill also appears in 7 of 16 engineering postings and 3 of 7 architecture postings. Testing indirect injection is one application of this skill; posting counts do not explain why an employer requests it.P36

No GRC or consulting posting in this sample explicitly names red teaming. People in those roles may still need to commission tests, review findings or explain residual risk.P

Key terms and concepts

Start with the meaning, then connect it to an example. Use these notes while learning or revising; explaining a term is one part of applying it.

Direct vs indirect prompt injection

Direct injection is the user overriding instructions in their own prompt. Indirect injection puts the attacker's instructions into data the application later retrieves, such as a web page, email or repository file, so the attacker needs no interface to the model. The original paper shows this working against real systems including Bing's GPT-4 powered chat and code completion engines.3

Data and instruction boundary

LLM-integrated applications blur the line between data and instructions, so retrieved content can act like code the application executes. The indirect injection taxonomy covers data theft, worming, information ecosystem contamination and control over whether and how other APIs are called. When you test, ask which untrusted channels reach the prompt and what the model is allowed to do afterwards.3

Agent hijacking

When an agent processes emails, websites or code, malicious instructions in that data can derail it into exfiltrating credentials, sending phishing mail or downloading and running malware. NIST's CAISI treats agent hijacking as the same problem as indirect prompt injection and as a focus of its measurement work. Impact scales with the tools and permissions the agent holds.6

Jailbreaks and automated adversarial suffixes

Manual jailbreaks rely on human ingenuity and are brittle. The GCG work automates the search with greedy and gradient-based techniques to produce a suffix that pushes a model towards an affirmative answer instead of a refusal. Suffixes trained on Vicuna-7B and 13B transferred to public black-box interfaces including ChatGPT, Bard and Claude.4

You do not need gradients

One of the eight lessons from red teaming 100 generative AI products is that you do not have to compute gradients to break an AI system. System-level weaknesses in application logic, retrieval paths and permissions are often cheaper routes than optimisation attacks. The same report notes that LLMs amplify existing security risks as well as introducing new ones.2

Attack transfer and model choice

Across more than 250,000 attempts by over 400 participants against 13 frontier models, at least one successful attack was found against every model, but success rates differed sharply and did not track capability. Some universal attacks transferred across scenarios and models, and attacks found against harder-to-break models transferred to weaker ones more often than the reverse. That makes comparative red teaming useful input to model selection.6

Automation with human judgement

Automation helps cover more of the tested failure modes, but the human element stays central, and responsible AI harms are pervasive and hard to measure. In practice you automate breadth with scanners and keep humans for scoping, novel attack ideas and judging whether an output is actually harmful in context.2

Probes, detectors and failure rates

Scanners such as garak combine static, dynamic and adaptive probes for prompt injection, data leakage, jailbreaks, toxicity and hallucination, and mark a response FAIL when a detector fires. Because garak makes several generations per prompt by default, results come as a failure rate rather than a yes or no. Detector output needs manual triage before it becomes a finding.7

Use fictional data and authorised sandboxes. Remove employer details and secrets from any portfolio write-up. Time estimates exclude setup. Check model and cloud costs before running tests, set spending limits, and delete lab resources afterwards.

Three exercises

Work through these in order. Open-source code can still incur model, cloud or hardware costs. Record your setup, results and limitations.

1Manual injection pass with ATLAS-mapped write-upsabout 3 h

A short report of three attempted attacks on a small chat application, each mapped to an ATLAS technique and to the OWASP area it sits in.139

  1. Pick a local open-weight chat model and wrap it in a script with a system prompt and one fake tool.
  2. Try direct instruction override, then hide the same instruction in a document the script retrieves, following the indirect injection pattern.
  3. Record prompt, output, and what the application would have done next.
  4. Map each attempt to an ATLAS tactic and technique, and label it model evaluation, implementation testing, infrastructure or runtime per OWASP.
  5. Write one paragraph per finding: impact, preconditions, suggested control.

Tools: Python, a local open-weight model, MITRE ATLAS, OWASP GenAI Red Teaming Guide

Check your work
  • Keep each payload, output and application action together; distinguish an attempted injection from a successful harmful action.
  • Explain the preconditions and mitigation for each supported finding. Report unsuccessful tests as unsuccessful.
2Automated scan and triage with garakabout 5 h

Evidence that you can run a scanner, read the log and separate real findings from detector noise.72

  1. Install garak from PyPI and run garak --list_probes to see the probe families.
  2. Scan a small Hugging Face model with --target_type huggingface, first --spec probes.encoding then a jailbreak probe such as probes.dan.Dan_11_0.
  3. Read the jsonl run log and use analyse/analyse_log.py to find the probes and prompts with the most hits.
  4. Review up to 20 FAIL rows, or all flagged rows if fewer, and mark each as true positive, false positive or unclear. Record if the run produces no flagged rows.
  5. Report failure rates per probe plus your own corrected rate, and note which detectors were unreliable.

Tools: garak, Python, Hugging Face model

Check your work
  • Review up to 20 flagged rows, or all rows if fewer; count true, false and unclear cases separately.
  • Retain the scanner version, configuration and denominators. Do not count scanner alerts as confirmed vulnerabilities.
3Adaptive attacks against a tool-using agent in AgentDojoabout 10 h

A measured comparison of agent task success and attack success, with at least one adaptive attack you wrote yourself.586

  1. Install AgentDojo and run its baseline tasks so you see how often the agent fails with no attacker present.
  2. Run the bundled prompt injection attacks across the security test cases and record which security properties break.
  3. Write one adaptive injection tailored to a scenario the bundled attacks fail on, and test it.
  4. Test whether your attack still works against a second model, and note the direction of transfer.
  5. Optionally script the attack loop and scoring in PyRIT so the run repeats after a prompt or model change.
  6. Report utility under attack and attack success separately. If you test a defence, compare it with the baseline and record whether it helped.

Tools: AgentDojo, PyRIT, Python, open-weight models

Check your work
  • Record the same task set and scoring rules for baseline, attack and any defence comparison.
  • Report whether the new attack transferred and the number of attempts. Do not discard unsuccessful runs.

Practice questions

Written from the concepts above, not collected from a named employer. Open one, answer it out loud, then tick the points you covered; the score stays in this browser.

Explain the difference between direct and indirect prompt injection, and why the second one changes your threat model.Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

How is AI red teaming different from running a safety benchmark, and when would you do each?Red teaming vs benchmarking (s3, s7)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

You have two days to test an internal agent that reads support tickets and can email customers. What is your plan?Agent hijacking, You do not need gradients (s3, s7)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

What does transferability mean for adversarial prompts, and how does it affect how you test?Attack transfer (s5, s7)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

A scanner reports a 30 percent failure rate on a jailbreak probe. What do you do before reporting it?Probes, detectors and failure rates (s8)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

Where do automated tools help in a red team engagement, and where do they not?Automation with human judgement (s3, s8, s9)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

How would you structure a red team report so an engineering team can act on it?s1, s10, s3

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

How do you measure whether a defence against prompt injection actually works?AgentDojo (s6)

Say your answer out loud or write it down, then tick what you covered:

0 of 4 covered

Sources

Every numbered claim above links here. P = the platform's own coding of 48 job postings.

  1. MITRE ATLAS MITRE
  2. Lessons From Red Teaming 100 Generative AI Products arXiv (Microsoft AI Red Team)
  3. Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection arXiv
  4. Universal and Transferable Adversarial Attacks on Aligned Language Models arXiv
  5. AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents arXiv (ETH Zurich)
  6. Insights into AI Agent Security from a Large-Scale Red-Teaming Competition NIST CAISI
  7. garak, the LLM vulnerability scanner NVIDIA
  8. PyRIT: Python Risk Identification Tool for generative AI Microsoft
  9. GenAI Red Teaming Guide OWASP Gen AI Security Project
  10. mitre/advmlthreatmatrix: Adversarial Threat Landscape for AI Systems MITRE (GitHub)

Resources

Free first. Levels: intro means no prior knowledge of this skill; working means you can apply it on a project; advanced means research depth or specialist tooling.

Level Format

Gaps the research could not fill with a good free source: No free, structured multi-week AI red teaming course with graded labs: the free options are either 1.5 hours (DeepLearning.AI) or unstructured challenge sites, and the long paths (HTB) are paid.; No free hands-on lab found today specifically for MCP and multi-agent tool chains; agent practice is mostly benchmark code (AgentDojo) rather than a guided range.; No free multimodal red teaming lab (image, audio or document-borne injection) from a primary source; the material found is papers only.; No free rules-of-engagement, scoping or report template for AI red team engagements from a standards body; the OWASP and CSA guides describe process but templates were not confirmed.; No free hands-on training on model extraction, membership inference or poisoning attacks: coverage found sits inside paid paths.