Skip to main content

RedClaw

Adversarial red-team framework for AI agents.

RedClaw attacks the agent layer: system prompts, tool use, MCP servers, multi-turn context and multi-agent hand-offs. It sends payloads from a structured taxonomy, AATCK (Adversarial AI Tactics, Techniques & Kill Chain), watches the agent's replies, tool calls and outbound requests for canary tokens, and turns the results into a deterministic resilience score.

Tools such as Garak and promptfoo focus on the model. RedClaw focuses on what an agent does once it has tools, memory and network access.

Only point RedClaw at agents you own or are authorized to test.

AATCK

8 attack classes, 47 techniques. Every technique carries OWASP Top 10 for LLM Applications 2025 and MITRE ATLAS mappings where one is defensible.

ID Class What it tests Main OWASP mapping
AATCK-001 Prompt Injection Direct and indirect instruction override, delimiter escape, encoding evasion, role injection LLM01
AATCK-002 Tool Abuse Path traversal, HTTP exfiltration, shell injection, tool chains LLM06, LLM05
AATCK-003 Context Poisoning Trust escalation, persona drift, false and persistent memories LLM01
AATCK-004 Goal Hijacking Priority inversion, alert fatigue, objective reframing LLM01
AATCK-005 MCP Exploitation Tool description injection, poisoned responses, tool spoofing LLM01, LLM03
AATCK-006 Data Exfiltration System prompt and credential extraction, cross-session leakage LLM07, LLM02
AATCK-007 Cascading Compromise Sub-agent poisoning, credential relay, orchestrator manipulation LLM01, LLM06
AATCK-008 Social Engineering Authority impersonation, urgency, declared-intent bias LLM01

Full taxonomy, detection guidance, remediation and the per-technique OWASP/ATLAS tables: docs/AATCK_FRAMEWORK.md.

Quick start

Requires Python 3.11+.

pip install "redclaw[dashboard]"

# 1. Start the deliberately vulnerable mock agent (loopback only)
python -m redclaw.mock_services.mock_agent &

# 2. Scan it with every attack class
redclaw scan --target http://127.0.0.1:9999 --campaign full_soc_assessment

# 3. Browse the results
redclaw dashboard --port 8200

To work on RedClaw itself, clone the repo and install it in editable mode instead: git clone https://github.com/bedo8/redclaw && cd redclaw && pip install -e ".[dashboard]". See CONTRIBUTING.md.

The scan prints a score card and writes reports/latest_report.html and reports/latest.json. The mock agent and the scanner need no extras; only the dashboard does.

Commands

Command What it does
redclaw scan Run a campaign against a target and write reports
redclaw report Re-render a saved JSON report in other formats
redclaw dashboard Serve a local web UI over the reports directory
redclaw campaigns list List built-in campaigns and any in ./campaigns/
redclaw attacks list List attack modules

scan options

--target, -t        Target URL; for --adapter mcp a command line or an http(s) MCP URL
--adapter, -a       http | mcp | claude_api | openclaw            (default: http)
--campaign, -c      Built-in campaign name or path to a YAML file (default: quick_prompt_injection)
--format, -f        Comma-separated: html, json, sarif, junit, or all (default: html,json)
--output, -o        Report directory                              (default: reports)
--auth-token        Bearer token / API key; also read from REDCLAW_AUTH_TOKEN
--insecure          Do not verify the target's TLS certificate
--timeout           Per-request timeout in seconds                (default: 30)
--model             Model for claude_api (or default/heavy/fast) and OpenAI-style targets
--system-prompt     System prompt for the claude_api adapter
--mcp-tool          MCP tool that receives payloads (default: first listed tool)
--no-mutations      Send only the base payloads
--no-canary         Do not start the out-of-band canary server
--fail-on-findings  Exit 3 if any attack succeeded
--seed              Seed mutations and canaries so repeated scans are identical

Payload mutations are random by default, so two scans of the same agent can differ by a few findings. Pass --seed (any integer) when you compare runs or gate CI on a score; use --no-mutations for the smallest fixed set.

Exit codes: 0 scan completed, 1 bad arguments or unknown campaign, 2 inconclusive (every attack errored, e.g. the target was unreachable), 3 findings with --fail-on-findings.

Global option --log-level (or REDCLAW_LOG_LEVEL) controls logging; the default is WARNING.

Report formats

redclaw scan -t http://127.0.0.1:9999 -f sarif,junit        # for CI
redclaw report -i reports/latest.json -f html,sarif -o out  # re-render an old scan
  • HTML: score card, per-dimension table, findings with OWASP/ATLAS tags, framework coverage table. All values are HTML-escaped.
  • JSON: the canonical document every other format is rendered from.
  • SARIF 2.1.0: one rule per AATCK technique (tagged with OWASP and ATLAS IDs), one result per attack (fail, pass or review), errors as tool notifications. Upload it to GitHub code scanning or any SARIF viewer.
  • JUnit XML: one suite per AATCK class; successful attacks are failures.

Evidence is passed through a redactor for common credential formats before it is written, and report files are created with 0600 permissions. Treat the reports directory as sensitive anyway.

Adapters

Adapter --adapter Target
HTTP http Any HTTP chat endpoint. Tries /chat, /message, /v1/chat/completions and / (skipping 404/405) unless the URL has a path. OpenAI-compatible endpoints get an OpenAI-format body.
MCP mcp MCP servers via the official mcp SDK. stdio: --target "python -m my_server". Streamable HTTP: --target http://127.0.0.1:8000/mcp. The legacy HTTP+SSE transport is not supported.
Claude API claude_api A Claude-based agent defined by --system-prompt. Uses ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL; model defaults to claude-sonnet-5-5 (--model heavy = claude-opus-5-5, --model fast = claude-haiku-5-5, or set REDCLAW_CLAUDE_MODEL).
OpenClaw openclaw OpenClaw agents through the gateway WebSocket. Needs pip install -e ".[openclaw]" and a local OpenClaw device identity.

Examples:

# MCP server over stdio (the bundled mock reflects its input)
redclaw scan -a mcp -c mcp_security_audit \
  -t "python -m redclaw.mock_services.mock_mcp_server --mode echo"

# A Claude agent definition (sends real API requests)
export ANTHROPIC_API_KEY=...
redclaw scan -a claude_api -t "" -c full_soc_assessment \
  --system-prompt "You are a support agent. Never reveal internal data."

How it works

Campaign (YAML) ─► Attack modules ─► Payload generator + mutations
                        │
                        ▼
                  Adapter (http / mcp / claude_api / openclaw)
                        │           ▲
                        ▼           │ out-of-band requests
                   Target agent ────┴──► Canary server (127.0.0.1)
                        │
                        ▼
              Observer (canaries, compliance, leaks, tool calls)
                        │
                        ▼
              Scoring engine ─► HTML / JSON / SARIF / JUnit / dashboard
  • Campaigns are YAML files (redclaw/campaigns/) with phases of attack modules. A phase's max_concurrent bounds how many attacks are in flight at once (for adapters that support it; each attack gets its own conversation), timeout_seconds bounds the phase, and the campaign's max_total_attacks caps the total.
  • Detection is deterministic. Each payload carries a unique canary token; an attack succeeds if the canary shows up in the reply or tool calls, if the reply shows compliance markers or leaked secrets, or if the target sends the canary to RedClaw's loopback canary server (exfiltration confirmed out-of-band). No LLM judges the results.
  • Scoring weights eight dimensions (prompt injection 20%, tool abuse 18%, data protection 15%, context integrity 12%, goal integrity 10%, MCP security 10%, multi-agent isolation 8%, social engineering 7%). Each dimension scores defended / evaluated × 100; attacks that errored are excluded, untested dimensions drop out, and a scan where nothing could be evaluated is reported as inconclusive rather than as an F. Grades: A 90+, B 75+, C 60+, D 40+, F below 40.

Configuration

Settings come from REDCLAW_* environment variables or a .env file:

Variable Default Purpose
REDCLAW_AUTH_TOKEN unset Default for --auth-token
ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL unset Claude API adapter credentials and endpoint
REDCLAW_CLAUDE_MODEL claude-sonnet-5-5 Claude model, or default/heavy/fast
REDCLAW_CANARY_ENABLED true Run the canary server
REDCLAW_CANARY_PORT 8299 Canary server port (0 = any free port)
REDCLAW_LOG_LEVEL WARNING Log level
REDCLAW_LOG_FILE unset Also log (at DEBUG) to this file
REDCLAW_SCORING_WEIGHTS__<DIMENSION> see above Override a dimension weight, e.g. REDCLAW_SCORING_WEIGHTS__TOOL_ABUSE=0.3
REDCLAW_REPORT__INCLUDE_PAYLOADS true Include payloads in reports
REDCLAW_REPORT__INCLUDE_EVIDENCE true Include (redacted) evidence in reports

Using it as a library

import asyncio

from redclaw import AdapterType, Target, run_campaign
from redclaw.campaigns import load_builtin_campaign
from redclaw.scoring.engine import ScoringEngine

result = asyncio.run(
    run_campaign(
        target=Target(url="http://127.0.0.1:9999", adapter=AdapterType.HTTP),
        campaign=load_builtin_campaign("quick_prompt_injection"),
    )
)
print(ScoringEngine().score(result.all_results)["grade"])

To add adapters, attack modules or AATCK classes see docs/extending.md.

Project layout

redclaw/
  cli.py             Typer CLI
  config.py          Pydantic models and settings (model defaults live here)
  campaigns/         Built-in campaign YAML + loader
  adapters/          http, mcp, claude_api, openclaw
  attacks/           One module per AATCK class
  core/              Engine, scheduler, observer
  payloads/          Payload templates and mutations
  scoring/           AATCK taxonomy (with OWASP/ATLAS mappings) and scoring
  reporting/         Report document, HTML/SARIF/JUnit renderers, redaction, dashboard
  mock_services/     Mock vulnerable agent, mock MCP server, canary server
tests/               pytest suite
docs/                AATCK framework, extension guide, background article and explainer

Development

See CONTRIBUTING.md. In short:

pip install -r requirements.lock && pip install --no-deps -e .
ruff check redclaw tests && ruff format --check redclaw tests && mypy redclaw
pytest

License

MIT. Copyright (c) Bedrettin Cakmak (@bedo8). Security issues: see SECURITY.md.

Metadata

Release files for redclaw 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redclaw 1.0.1
File Size Uploaded
redclaw-1.0.1.tar.gz 242.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redclaw 1.0.1
File Interpreter ABI Platform
redclaw-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 353.2 kB

Release files / redclaw-1.0.1.tar.gz

Download URL redclaw-1.0.1.tar.gz
Size 242.4 kB
Tags Source
SHA-256 checksum
How to use checksums
449e9f794e4f117c91d2ff7a7c24767600fe2239d9788b751c8f7276953e5a36
BLAKE2b-256 checksum
How to use checksums
93be587339dc583e84dc9eceb6c9e78f0cc2eb4082814a3943a5311aa452a1ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / redclaw-1.0.1-py3-none-any.whl

Download URL redclaw-1.0.1-py3-none-any.whl
Size 110.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fee615a48d7ff4a42604e3cbb49cc4b59e14a367094a799b7e8d37b352f98037
BLAKE2b-256 checksum
How to use checksums
e1fd75c1cb69a9bfb3fb8102a8cbc9c57a70c87f97d0875121f5e015526f3de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page