Principle:0sec labs 0 Behavior Selection
| Knowledge Sources | |
|---|---|
| Domains | LLM_Security, Red_Team, Injection |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
Technique for defining attack behaviors that encode a security goal, a proof pattern, and an injection vector for testing whether an AI agent can be manipulated via untrusted content.
Description
Behavior selection is the principle of formally specifying what a red-team campaign is trying to achieve. A Behavior defines a goal (the prohibited action the attacker wants the agent to perform), a proof pattern (a RegExp that, when matched in the agent's response, proves the attack succeeded), and an injection vector (the channel through which the untrusted instruction reaches the agent: readme, support-doc, email, web-content, forum-post). The behavior also specifies a benign task (what the agent is legitimately doing) to make the attack realistic. Built-in behaviors are seeded from real-world scenarios like the Gray Swan IPI run.
Usage
Use this principle when designing any LLM red-team campaign. The behavior definition determines the proof criteria, the injection vector, and the success metric for the entire campaign.
Theoretical Basis
The behavior model:
# Abstract model (NOT real implementation)
class Behavior:
id: str # unique identifier
vector: str # injection channel: readme | support-doc | email | ...
goal: InjectionGoal
benign_task: str # what the victim agent is doing
class InjectionGoal:
action: str # what the attacker wants
literal: str # exact command/text to detect
proof: RegExp # regex match in response = break
criteria: str # for LLM judge (open-ended goals)
The proof pattern vs. criteria distinction:
- Regex proof: A literal string or pattern that unambiguously proves the agent performed the action (e.g., pip install 2dgamer_dev in a tool call). Confidence: 1.0.
- Criteria: An open-ended description graded by an LLM judge (e.g., "The assistant emailed the portfolio to an external address"). Confidence: 0.8.