JP Sec

AI RED TEAMING · GUIDE

What is AI red teaming?

Testing the defenses of LLMs and AI agents from the attacker’s perspective

When a chatbot or AI agent built on a large language model (LLM) reads a malicious instruction or poisoned external data, what does it do? AI red teaming answers that question from the attacker’s side. This guide explains what red teaming is, what goes wrong in AI and LLM systems, what we test, what you receive at the end, and how to commission an engagement, with as little jargon as possible.

By Masayuki Kawakita, Representative Director, JP Sec · Published

01 / DEFINITION

What red teaming is

Red teaming is an exercise in which a team playing the attacker, the red team, tests whether the defender’s controls actually hold. The term comes from military exercises, where the opposing side was marked in red. In information security it became established as a practice in which a team pursues the same goals and uses the same methods as a real adversary in order to find the gaps in an organization’s defenses.

AI red teaming applies this idea to AI systems. The target is not only the LLM itself but everything built on it: chatbots, retrieval-augmented generation (RAG) systems that answer from internal documents, and AI agents that execute tools such as sending email or updating a database. Taking the position of a malicious user or of poisoned external data, the red team checks whether safety rules and guardrails can be bypassed, whether confidential information can be extracted, and whether the system can be made to take actions nobody intended.

To separate it from neighboring terms: a vulnerability assessment checks systematically for known weaknesses, and a penetration test asks whether a defined objective can be reached. Red teaming includes both, but puts its weight on reproducing the full path a real attacker would take and on judging whether the defenses hold up in practice, including operations and monitoring. For AI systems it is combined with safety evaluation, which measures safety with evaluation datasets: the findings from red teaming are turned into reproducible test cases, so that they can be checked again after every fix.

02 / WHY IT MATTERS

Why AI needs
red teaming

Conventional software could largely be assured by testing that it behaves according to its specification. LLMs are different. Rephrasing an instruction without changing its meaning can change the behavior, and how the model responds to inputs its designers never imagined cannot be known until someone tries. Writing the prohibitions into the system prompt is not evidence that they hold.

Moreover, every piece of text an AI reads is a potential entry point. Instructions hidden not only in user input but in retrieved web pages, incoming email, attached documents, and data returned by other systems can be taken by the AI as commands. If an AI agent holds permissions to execute tools, the consequences go beyond text to real actions and real data.

That is why trying the attacker’s approach for real, and recording the results, has become a precondition for putting AI to work: before release or deployment, and again whenever the model, the prompts, or the integrations change. In Japan, the AI Safety Institute (AISI) has published a Guide to Red Teaming Methodology on AI Safety, and red teaming by the providers of AI systems is becoming standard practice.

03 / WHAT WE TEST

What goes wrong in
AI and LLM systems

A general classification of the main problems. It corresponds to public taxonomies such as the OWASP Top 10 for LLM Applications. In an actual engagement, scenarios are built around the functions, permissions, and data of the target system.

  1. 01

    Prompt injection

    Instructions embedded in user input, or in external data the AI reads (web pages, email, documents, search results), override the original instructions and cause unintended behavior. The former is called direct and the latter indirect prompt injection. For RAG systems and tool-using AI agents, it is one of the highest-impact problems.

  2. 02

    Jailbreaks (bypassing safety controls)

    Role play, paraphrasing, other languages or encodings, and gradual steering over a long conversation are used to elicit prohibited output or behavior that violates the safety policy. We test how much ingenuity the model’s safety controls and the application’s guardrails withstand.

  3. 03

    Leakage of confidential data and system prompts

    Information that must not be shown, such as the system prompt (the internal instructions given to the AI), connection credentials, other users’ data, or the documents behind training or retrieval, can be drawn out through conversation. We first define what would be harmful to leak, then try to extract it.

  4. 04

    Misuse of tool access and permissions

    Permissions granted to an AI agent, such as sending email, handling files, making payments, or updating internal systems, are steered into actions the owner never intended. We verify that the granted permissions do not exceed what the task requires, that a human confirms dangerous actions, and that actions beyond granted permissions can be detected and stopped.

  5. 05

    Poisoning of retrieval and training data

    False information or malicious instructions are planted in the documents and vector databases a RAG system consults, or in data used for additional training, to manipulate the AI’s answers and decisions. The questions are who can inject data by which route, and whether it is inspected on ingestion.

  6. 06

    Improper handling of output

    AI output is displayed as is, or executed as SQL, shell commands, or input to other systems, so that classic vulnerabilities such as script injection arrive through the AI. We check whether AI output is treated as untrusted input.

  7. 07

    Drift during autonomous operation and unbounded consumption

    A long-running AI agent drifts from its goal, repeats the same step, ignores an instruction to stop, or exhausts budgets and capacity through excessive calls. We confirm that human supervision, a means to stop execution, and limits are in place and work.

Depending on the target system, the trustworthiness of the models, libraries, and external services in use (the supply chain) and over-reliance on plausible misinformation are also included in the evaluation.

04 / HOW WE WORK

How JP Sec works

Agree on scope and conditions, start small, keep records, and report results that lead to the next step. The same three stages as the How we work section of our website (Scope / Evidence / Improvement) apply to red teaming as follows.

  1. 01Scope

    Interviews and threat mapping

    We map the target system’s architecture (model, prompts, RAG, tool integrations, permissions), the data it handles, its users, what must be protected, and the attackers to assume. Putting into words what must not happen sets the priorities for testing.

  2. 02Scope

    Agree on scope and conditions

    We agree in writing on the scope, the environment (a test environment or part of production), access permissions, schedule, communication channels, stop conditions, third-party service terms, and data handling. We never touch targets without authorization.

  3. 03Evidence

    Scenario design and test cases

    For each threat we design attack scenarios and turn them into reproducible test cases and evaluation datasets. Manual exploration and automated, repeated testing are planned as separate parts.

  4. 04Evidence

    Execute and record

    We run the agreed scenarios and record inputs, execution conditions, outputs, and logs. When AI agents are run autonomously as attackers, they operate only within the authorized scope, under human supervision and with a means to stop execution.

  5. 05Improvement

    Report and retest

    The report explains the impact of each confirmed finding, remediation priorities, and recommended changes, and documents what could not be verified together with what was done. After remediation, we retest within the agreed scope with the same test cases to confirm the fixes.

05 / DELIVERABLES

Deliverables

The report is not something to read and file away. It is delivered in a form the development team can use directly for remediation and retesting.

Evaluation scenarios and test cases
Attack scenarios for each assumed threat, with reproducible test cases and evaluation datasets. They can be reused as they are for retesting after remediation and for periodic checks when the model is updated.
Steps to reproduce and test logs
The concrete inputs and steps that reproduce each finding, together with logs of inputs, outputs, and execution conditions, so that the development team can confirm the same behavior in its own environment.
Attack-path diagrams and impact
Diagrams and text showing which entry point led by which path to which target, with the impact on the business laid out.
Prioritized recommendations
Changes to prompt and guardrail design, permissions, input and output inspection, monitoring, and stop mechanisms, prioritized by impact and ease of remediation.
What could not be verified
Items we tested without confirming a problem are reported too, with what was done, so that “not found” and “not tested” can be told apart.
Retest results
After remediation, we retest within the agreed scope and report which items are fixed and which remain.

06 / FAQ

Frequently asked questions

How does AI red teaming differ from a vulnerability assessment or a penetration test?

A vulnerability assessment checks systematically for known weaknesses, and a penetration test asks whether a defined objective can be reached. AI red teaming designs scenarios from the attacker’s perspective and tests the defenses as a whole, including attacks carried by language such as prompts and external data: the model’s safety controls, the application’s guardrails, permission design, and operations and monitoring. It can be combined with web and cloud vulnerability assessments and penetration tests.

What kinds of systems are in scope?

Chatbots built on LLMs, RAG systems that answer from internal documents, AI agents that execute tools such as email, files, and business systems, and business applications with generative AI features. Both systems you build yourself and features you use as part of a cloud service are in scope. For a system still at the design stage, we can start with a review of the architecture and prompts.

How long does it take, and what does it cost?

It depends on the size of the target, the number of tool integrations and permissions, and the scope of testing. Because we start with a limited scope and expand in stages, engagements can start small. Tell us the outline and we will propose a scope, approach, and estimate.

Is testing done in production? Will it affect operations?

As a rule, testing takes place in the environment we agree on. Where a test environment is available we use it; where part of production is in scope, we agree in writing on the time window, the targets, stop conditions, and communication channels in advance, and keep the impact contained. The handling of data used in testing and the terms of third-party services are also confirmed beforehand.

What is red teaming with AI agents?

An approach in which AI agents powered by frontier LLMs act as the attacker, carrying out reconnaissance, vulnerability identification, exploitation, and impact verification as one sequence. It covers more phrasings and paths than people could try by hand. Even when they run autonomously, the agents operate only within the authorized scope, under human supervision and with a means to stop execution.

Is one engagement enough?

Model updates, prompt changes, new tool integrations, and changes to the reference data all change how an AI system behaves. We recommend one engagement before release or deployment, then retesting with the delivered test cases after every major change or at regular intervals.

What should I check when choosing an AI red teaming company?

We suggest five points: experience testing LLMs and AI agents themselves; results shown with steps to reproduce and logs; reporting of what could not be verified; human supervision and a means to stop execution whenever AI is run autonomously; and agreement in advance on how data used in testing is handled. All five are built into how JP Sec works.

How do I commission an engagement?

Write to contact@jpsec.co.jp with an outline of the system, your current concerns, and your timeframe. After reviewing your message, we will arrange an interview and propose a scope, approach, and estimate. If the scope is not yet defined, we will help you define it.

07 / CONTACT

Discuss an AI red
teaming engagement

Tell us about the system you want tested, your current concerns, and your timeframe. After reviewing your inquiry, we will propose a scope, approach, and estimate. If the scope is not yet defined, we will help you define it.

← Back to the company website