Method · 3 min read

Method

AI red teaming: how I test LLM applications and agents

What I look for in LLM applications, model APIs and tool-using agents, how an engagement runs from scope to retest, and what makes a finding worth fixing.

By Kursad AlsanPublished 3 min read

  • AI red teaming
  • Prompt injection
  • Agents
  • Methodology
kinds of target
3
attack classes
6
steps, scope to retest
5

The short version

  • I test three kinds of target: LLM applications, the model APIs behind them and agents that act through tools.
  • An injected instruction matters when it reaches data or a tool, so I test the whole chain, not just the prompt.
  • A finding is only useful if it reproduces: the exact prompts and requests, the model's behavior and the impact, then a retest after the fix.

AI red teaming is adversarial testing of AI systems: attacking them the way a real adversary would, under agreed rules, to find what breaks before someone else does. My work combines prompt injection and jailbreak testing with the web and API security research I have done since 2014. This is how I approach it.

What I test

The target is rarely just a model. It is an application built around one: a system prompt, retrieved documents, tools, memory and an API in front of it all. Each of those is attack surface.

  • Prompt injection

    Input that overrides the system prompt or the developer's intent, typed straight into the app.

  • Indirect prompt injection

    Instructions hidden in content the model reads: documents, web pages, emails or tool output. The user never sees them; the model does.

  • Jailbreaks and safeguard bypass

    Getting the model to produce what its safeguards are meant to stop, through role play, encoding or pressure across many turns.

  • Tool abuse

    Agents act through tools. Can attacker-influenced input make an agent call a tool it should not, or with arguments it should not use?

  • Data leakage

    System prompts, other users' data, retrieval sources and secrets that end up in a response or a log.

  • Sandboxing and containment

    Where an agent runs code or touches files, does the sandbox actually hold it?

Model APIs are still APIs, so the classic checks apply too: authentication, and authorization on every object a request can name. IDOR/BOLA does not go away because the client is a chatbot; it is the same class of bug I reported to Grafana.

How an engagement runs

  1. Scope and rulesauthorized targets, safety limits
  2. Map the systemmodel, tools, data, trust boundaries
  3. Attack and chaindirect, indirect, multi‑step
  4. Evidence and reportreproducible, with remediation
  5. Fix and retestuntil the finding is closed

Mapping is where most of the work hides. I draw the trust boundaries: what the model can read, what it can call, with whose permissions, and where its output goes next. Every arrow that crosses a boundary is a test case.

An attack path, step by step

A single injected instruction is rarely the finding on its own. What matters is where it leads. This is the shape of a typical indirect prompt injection against a tool-using agent:

  1. PlantInstructions hidden in a documenta page, file or email the agent will readattacker in control
  2. RetrieveThe agent reads itas part of an ordinary user task
  3. HijackThe model follows the injected textinstead of the user's requestattacker in control
  4. ActA tool call with attacker-chosen argumentssend, fetch or writeattacker in control
  5. ImpactData leaves, or an action runswithout the user's intent
3 of 5 hops are attacker-controlled.

An illustration of the pattern, not a client finding.

Each hop is a place to break the chain: treat retrieved content as data, not instructions; give every tool the least privilege it needs; and ask a person to confirm sensitive actions. A good report names the hop where the fix belongs.

Evidence that reproduces

Model output varies from run to run, so a single screenshot is weak evidence. For every finding I capture:

  • The exact prompts and inputs, including any content planted for indirect injection.
  • The requests and responses at the API level, not only the chat window.
  • The model's behavior, and how often it repeats across runs.
  • The impact, in one sentence a product owner can act on.

I script the repeatable parts in Python and Bash and run them in isolated Docker and Linux environments, so a retest is the same test, not a new one.

Authorized and scoped

All of this runs under agreed rules of engagement and safety constraints, against systems I am authorized to test.

Fix, then retest

A report is only useful if the fix holds. I pair every finding with remediation guidance, work with the engineering team on the change and retest until the finding is closed.

In November 2026 I earned OffSec's AI Red Teamer certifications, OSAI and OSAI+, from the Advanced AI Red Teaming course (AI-300).

Sources

Keep reading

All posts
  • Guide

    OWASP Top 10 for LLM Applications 2026: a pentest guide

    A practical penetration testing guide to the ten risks in OWASP's 2026 list for LLM applications: what to test, how to test it safely, what evidence to keep and which fix to retest.

    23 min read

  • Write-up

    CVE-2022-21713: an IDOR in Grafana's Teams API

    Three Teams API endpoints in Grafana returned team data to users who should not see it. What the flaw was, how the fix shipped in 21 days, and how to test for the same class of bug.

    3 min read

  • Story

    Twelve years of bug bounty, from Facebook to MSRC

    From Facebook's 2014 thanks page to Microsoft's Most Valuable Researcher list, Apple's acknowledgements and DEF CON: the route so far, from public records.

    3 min read

Need an AI red team assessment?

LLM applications, model APIs and agents, tested under agreed rules.