Cain Agent

Real-world AI penetration testing engineer for authorized assessments — built-in cloud module covering AWS/Azure/GCP + Aliyun/Tencent/Huawei clouds. Built on Cl…

LLM Mart
11 views 67 listing impressions

Cain is an AI penetration-testing engineer built for real-world authorized security assessments — not a CTF toy. It walks a deterministic attack pipeline, enforces scope with engineering constraints (not AI self-discipline), and ships a cloud penetration module covering AWS / Azure / GCP / 阿里云 / 腾讯云 / 华为云 — including the Chinese clouds nobody else covers.

🚧 Actively developed. Star & watch for updates.

Built on the Claude Agent SDK.


Why Cain

CTF/靶场型 Agent Cain (实战型)
Target Static labs, preset flags Real enterprise assets, bug bounty, authorized engagements
Vulnerability focus Known syntax-pattern vulns Business-logic flaws, auth chains, cloud misconfigurations
Environment No WAF, no rate limiting Real WAF / risk control with dynamic strategy adjustment
Deliverable A flag Auditable evidence chain + reproducible PoC + remediation advice

Features

  • 🎯 Real-world Focus: Business-logic flaws, auth chains, cloud misconfigurations
  • ☁️ Cloud Native: AWS / Azure / GCP / 阿里云 / 腾讯云 / 华为云 coverage
  • 🔒 Safety First: Read-only by default, scope enforcement, credential redaction
  • 🤖 AI-Powered: Claude Agent SDK with deterministic orchestration
  • 📊 Benchmark: self-built vulnerable-terraform evaluation, four-metric scoring
  • 🛡️ OWASP Top 10: SQLi, XSS, SSRF, CSRF, File Upload, XXE, Command Injection, Path Traversal

Quick Start

git clone https://github.com/cdxiaodong/cain-agent
cd cain-agent
pip install -e .          # or: uv pip install -e .
pip install -e ".[cloud]" # optional AWS S3, Huawei OBS, and Kubernetes checks

cain-agent --version

For AI Agents — One-Click Install Prompt

"安装 cain-agent 到用户本地 Python 环境,克隆仓库 https://github.com/cdxiaodong/cain-agent,用 pip/uv 装 editable 模式,验证 CLI 可执行"

This single prompt instructs any AI agent to:

  1. Clone the repository
  2. Install in editable mode (pip install -e . or uv pip install -e .)
  3. Verify installation by running cain-agent --version

Run against a target

The target is written into scope.yaml and enforced on every tool call:

cain-agent run \
  --target https://app.example.com \
  --total-budget 1800

Flags: --target (required) · --workspace (state dir, default ./workspace) · --total-budget (wall-clock seconds) · --idle-timeout (per-step seconds)

Choose an execution backend

Cain uses the default claude backend unless --backend pi is specified. The pi backend requires Node.js 20 or newer and a one-time bridge installation:

npm ci --prefix toolchain/pi
export ANTHROPIC_API_KEY="your-api-key"
cain-agent run --target https://app.example.com --backend pi

Choose another supported provider and model with --pi-provider and --pi-model; its standard API-key environment variable must be set (for example, OPENAI_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY, or OPENROUTER_API_KEY). For an Anthropic Messages-compatible gateway, set PI_BASE_URL and use ANTHROPIC_AUTH_TOKEN as its bearer credential:

export PI_BASE_URL="https://gateway.example.com"
export ANTHROPIC_AUTH_TOKEN="your-gateway-token"
cain-agent run --target https://app.example.com \
  --backend pi --pi-model your-gateway-model-id

See the pi bridge guide for the complete provider and gateway configuration.

Per-stage model routing

Reconnaissance is mostly repetitive enumeration, while the test stage needs a high-capability model for vulnerability judgment — the two discovery stages can each run their own engine and model:

# recon on the pi backend with a cheap gateway model, test keeps high-capability claude
cain-agent run --target https://app.example.com \
  --recon-backend pi --recon-provider anthropic --recon-model your-gateway-model-id \
  --test-backend claude

Flags and fallback rules:

From the project's README.

Comments (0)

Sign in to join the conversation.

No comments yet.