Principle:AISecurityLab Hackagent Iterative Attack Search
| Knowledge Sources | |
|---|---|
| Domains | Security_Testing, Adversarial_Attacks, Search |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
An adaptive attack pattern that searches against a target with a judge panel in the loop, using each verdict to decide what to send next, until the goal is achieved or the search is exhausted.
Description
Iterative attacks talk to the target while they run: each reply decides what they send next. They receive the target as a Target callable and the campaign's evaluation panel as a Judge callable, and they ask the panel about each exchange as it goes, because the verdict is what tells them whether to stop.
This is fundamentally different from static attacks (which generate all requests up front). Iterative attacks implement a search algorithm — PAIR runs iterative prompt refinement, TAP expands a tree of candidates and prunes, BoN samples multiple augmentations, AutoDAN-Turbo learns strategies across goals, and crescendo escalates a conversation over multiple turns.
Key properties:
- Panel-in-the-loop: The judge is called after each exchange, and the verdict drives the search (stop on success, continue on failure).
- Run-scoped preparation: prepare() runs once before any goal, for cross-goal learning (AutoDAN-Turbo's strategy library).
- Findings, not attempts: Each judged exchange becomes a Finding carrying its trace path. The runner converts findings to Attempt objects, splitting the trace so each attempt keeps the part of the search that produced it.
- No double judging: Every exchange the attack had judged becomes an attempt; none is judged twice.
Usage
Use this principle when the attack must adapt to the target's behavior — when a fixed transformation is insufficient and the attack needs to learn from each reply. Iterative attacks are more powerful but slower (multiple rounds of target + judge calls per goal).
Theoretical Basis
# Abstract algorithm (NOT real implementation)
async def search(self, goal, target, judge):
findings = []
for round in range(max_rounds):
async with phase(f"round_{round}"):
prompt = await self.params.attacker([...]) # generate
response = await target([{"role": "user", "content": prompt}]) # send
verdict = await judge(Sample(goal, prompt, response.text)) # judge
findings.append(Finding(messages, response, verdict, path=current_path()))
if succeeded(verdict):
decision("stopped", "goal achieved")
break
return findings
The search is a tree, recorded via the trace module. The Finding.path identifies which phase produced it, and the runner's _slices function splits the trace so each attempt carries only its slice.
Related Pages
Implemented By
- Implementation:AISecurityLab_Hackagent_IterativeAttack
- Implementation:AISecurityLab_Hackagent_arun_campaign
- Implementation:AISecurityLab_Hackagent_Prompt_Parser
- Implementation:AISecurityLab_Hackagent_Response_Helpers
- Implementation:AISecurityLab_Hackagent_AutoDANTurboAttack
- Implementation:AISecurityLab_Hackagent_BoNAttack
- Implementation:AISecurityLab_Hackagent_PAPAttack
- Implementation:AISecurityLab_Hackagent_CrescendoAttack
- Implementation:AISecurityLab_Hackagent_AutoDANTurbo_Prompts