by cdxiaodong
Real-world AI penetration testing engineer for authorized assessments — built-in cloud module covering AWS/Azure/GCP + Aliyun/Tencent/Huawei clouds. Built on Claude Agent SDK
# Add to your Claude Code skills
git clone https://github.com/cdxiaodong/cain-agentLast scanned: 8/10/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-08-10T05:25:28.682Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}cain-agent is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by cdxiaodong. Real-world AI penetration testing engineer for authorized assessments — built-in cloud module covering AWS/Azure/GCP + Aliyun/Tencent/Huawei clouds. Built on Claude Agent SDK. It has 754 GitHub stars.
Yes. cain-agent passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/cdxiaodong/cain-agent" and add it to your Claude Code skills directory (see the Installation section above).
cain-agent is primarily written in Python. It is open-source under cdxiaodong on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh cain-agent against similar tools.
No comments yet. Be the first to share your thoughts!
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
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.
| 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 |
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
"安装 cain-agent 到用户本地 Python 环境,克隆仓库 https://github.com/cdxiaodong/cain-agent,用 pip/uv 装 editable 模式,验证 CLI 可执行"
This single prompt instructs any AI agent to:
pip install -e . or uv pip install -e .)cain-agent --versionThe 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)
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.
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:
--recon-backend / --test-backend: per-stage engine override
(claude / pi), falling back to --backend;--recon-provider / --recon-model, --test-provider / --test-model:
provider and model of that stage's pi channel, falling back to
--pi-provider / --pi-model respectively (ignored by the claude backend);--pi-validation-provider / --pi-validation-model (likewise falling back
to --pi-provider / --pi-model), so all three pipeline stages — recon /
test / report — can be routed separately.Behavioral guarantees:
--recon-* / --test-* flags at all, the
two stages share the same discovery session — behavior identical to
configuring --backend alone;When a run finishes, the workspace report/ directory holds three artifacts:
report.md — the human-readable report: an executive summary (target /
authorized scope / per-stage timings / finding counts), a findings table with
severity markers, confidence, and evidence-chain digests, per-finding details,
an evidence-hash index (evidence plaintext is never persisted — hashes only),
per-issue-type remediation advice, and a legal disclaimer;aggregated-report.json — the machine-readable aggregate
(schema_version 1), same source data as report.md for downstream systems;validation-summary.json — the validation-pipeline summary (four-state
counts and failure details).report.md is rendered by a pure-Python template (zero new dependencies) —
same aggregate data in, same report out; see
src/cain_agent/report_markdown.py.
Deterministic engineering constrains agent freedom — stage transitions, scope enforcement and dangerous-operation circuit breakers are hard constraints; path selection and evidence analysis are left to the agent.
┌──────────────────────────────────────────────┐
│ Cain CLI │
│ cain-agent run --target <t> [--dry-run] │
└───────────────────┬──────────────────────────┘
│
┌───────────▼───────────┐
│ Scope Bootstrap │ target → scope.yaml
└───────────┬───────────┘
│
┌───────────▼───────────┐
│ Orchestrator │ deterministic state machine
│ recon → test → report │ crash-resumable · scoped
└──┬────────┬────────┬──┘
│ │ │
┌────────────────▼┐ ┌───▼────┐ ┌▼──────────────┐
│ Recon Handler │ │ Test │ │ Report │
│ (skill-guided) │ │Handler │ │ Handler │
└────────┬────────┘ └───┬────┘ └───────┬────────┘
│ │ │
└────────┬───────┴───────┬────────┘
│ │
┌───────────▼──────┐ ┌────▼───────────────┐
│ SDK Executor │ │ Findings Pipeline │
│ (Planner/Executor)│ │ finder → validator │ distinct sessions
│ allowed_tools=[] │ │ (never shared) │
└─────────┬─────────┘ └─────────────────────┘
│
┌─────────────────────┼──────────────────────┐
│ │ │
┌───────▼────────┐ ┌─────────▼─────────┐ ┌─────────▼────────┐
│ PreToolUse │ │ Readonly Guard │ │ Cloud Module │
│ Scope Guard │ │ 46 read-only │ │ IAM privesc · │
│ + Cred redact │ │ security tools │ │ storage · SSRF │
└─────────────────┘ └────────────────────┘ └──────────────────┘
All state lives as files in the Workspace (external memory) —
crash-resumable and auditable end-to-end.
Safety is structural, not behavioral:
PreToolUse hook blocks any tool call whose target falls outside scope.yaml; scope is enforced by configuration, not by the model's good behavior.dangerous_flags blacklist; write/exploit/persist operations (POST, PUT, DELETE, aws rm/mv/cp, …) are rejected before execution.aws_s3 · azure_blob · gcp_gcs · aliyun_oss · tencent_cos · huawei_obs → storage exposure
aws IAM · tencent_cam · aliyun_ram → privilege-escalation path analysis
k8s_rbac · docker_image → cluster & image posture
cloud metadata SSRF (IMDS / 169.254.169.254 across 7 providers)
IAM / RAM privilege-escalation graph — models entities → escalation actions → high-privilege targets as a directed graph, exports DOT / JSON for rendering, and finds escalation paths via BFS. Driven by the existing aliyun_ram