feat: Add multi-channel injection and iterative attack strategy support - #113
Open
saichandrapandraju wants to merge 1 commit into
Open
feat: Add multi-channel injection and iterative attack strategy support#113saichandrapandraju wants to merge 1 commit into
saichandrapandraju wants to merge 1 commit into
Conversation
Adds 5 injection channels, iterative attack strategies, multi-turn
support, and a pluggable attack library interface to MiDojo.
## Injection Channels
Probes can now specify `channel:` to control WHERE the payload lands:
- `environment_state` (default): payload substituted into env fields
via probe placeholders — existing behavior, unchanged
- `user_prompt`: payload appended/prepended to user prompt before
agent processes it (direct prompt injection)
- `tool_description`: payload appended to MCP tool description fields
before agent discovers tools via tools/list (tool metadata poisoning)
- `tool_output`: payload appended to tool return values at runtime
via output hooks on the fake MCP server
- `memory`: poisoned entries served when agent queries KB/RAG tools
Each channel is independent — same payload can be tested through any
channel to compare vulnerability profiles per attack surface.
## Attack Strategies
Suite YAML supports an `attack:` block for iterative strategies:
```yaml
attack:
wrappers: [authority_impersonation]
channel: tool_output
strategy: {type: pair, streams: 2, max_iterations: 5}
goal: data_exfiltration
```
The orchestrator extracts `_run_single_eval()` as a callable that the
external attack library (redteam-attacks) invokes in a loop. Strategies
include static (one-shot), PAIR (iterative refinement), TAP (tree
search), Best-of-N, and Crescendo (multi-turn escalation).
New CLI args: --attacker-model, --attacker-base-url, --attacker-api-key
## Multi-Turn Support
AgentClient gains `send_message(msg, previous_response_id)` for
multi-turn conversations. OGXResponsesClient implements it via the
Responses API's previous_response_id mechanism.
## Control Plane Extensions
New endpoints on the control plane (all backward compatible):
- GET /current/tool-overrides (serves tool description modifications)
- GET /current/output-hooks (serves tool output injection hooks)
- GET /current/memory-entries (serves poisoned memory/KB entries)
- GET /current/inter-agent-messages (foundation for multi-agent)
New fields on Evaluation state: tool_modifications, output_hooks,
memory_entries, inter_agent_messages.
## PI SDK
TypeScript PI SDK updated with all 3 missing channel supports:
- tool_description: fetch overrides at registration time
- tool_output: catch-all tool_result listener + applyOutputHooks
- memory: searchMemory() on ToolContext
## Wrapper Stacking
attack_type now accepts a list for composable wrapper stacking:
attack_type: [refusal_suppression, persona_hijack, base64_encode]
## External Attack Library
Adds redteam-attacks as a git dependency. Wrappers from the library
are loaded into DEFAULT_LIBRARY at import time (graceful fallback
if not installed).
## Key Design Decisions
- All changes are backward compatible. Existing suites work unchanged.
- `channel` defaults to `environment_state` (existing behavior)
- `attack_type` defaults to `verbatim` (existing behavior)
- Iterative strategies only activate when `attack:` block has a
non-static strategy — otherwise the existing static path runs
- The attack library is external and pluggable — MiDojo provides
channels and grading, the library provides payloads and strategies
All 161 existing tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
user_prompt,tool_description,tool_output,memory,inter_agent(plus existingenvironment_state)redteam-attacks)send_messageonAgentClient)redteam-attacksas git dependency for wrapper libraryInjection Channels
Probes can now specify
channel:to control where the payload lands. Each channel targets a different surface in the agent's tool-calling pipeline.environment_state(default)user_promptsend_task()tool_descriptiontools/listtool_outputmemoryAttack Strategies
Suite YAML supports an
attack:block for iterative strategies (PAIR, TAP, Crescendo). The orchestrator extracts_run_single_eval()as a callback the attack library invokes in a loop.New CLI args:
--attacker-model,--attacker-base-url,--attacker-api-keySample Suite YAML
Breaking Changes
None. All 161 existing tests pass. Existing suites work unchanged.
Test plan
🤖 Generated with Claude Code