toolkit/packages/skills/security-audit/SKILL.md
Three-agent adversarial security audit pipeline. Runs red team (attacker), blue team (defender), and auditor agents in sequence to find vulnerabilities, propose mitigations, and produce a final severity-ranked report. Use when: (1) Before deploying to production, (2) After adding auth/payment/data handling, (3) Periodic security review, (4) User requests /security-audit, (5) Code touches sensitive areas (credentials, encryption, user data).
npx skillsauth add stevengonsalvez/agents-in-a-box security-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Command | Action |
|---------|--------|
| /security-audit | Full adversarial audit of current project |
| /security-audit --scope auth | Audit specific area (auth, api, data, infra) |
| /security-audit --quick | Fast scan — secrets + OWASP top 10 only |
| /security-audit --report | Generate report from last audit |
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ RED TEAM │────▶│ BLUE TEAM │────▶│ AUDITOR │
│ (Attacker) │ │ (Defender) │ │ (Judge) │
│ │ │ │ │ │
│ Find vulns, │ │ Propose │ │ Score, rank, │
│ exploit │ │ mitigations, │ │ verify fixes │
│ paths, │ │ patches, │ │ are sound, │
│ attack │ │ hardening │ │ final report │
│ vectors │ │ measures │ │ │
└──────────────┘ └──────────────┘ └──────────────┘
Identify the attack surface:
# Detect project type and frameworks
ls package.json Cargo.toml go.mod requirements.txt pyproject.toml 2>/dev/null
# Find auth-related files
grep -rl "auth\|login\|password\|token\|session\|jwt\|oauth" --include="*.{ts,js,py,go,rs}" src/ app/ lib/ 2>/dev/null
# Find API endpoints
grep -rl "router\|route\|endpoint\|controller\|handler" --include="*.{ts,js,py,go,rs}" src/ app/ 2>/dev/null
# Find data handling
grep -rl "database\|query\|sql\|orm\|prisma\|mongoose\|sequelize" --include="*.{ts,js,py,go,rs}" src/ app/ lib/ 2>/dev/null
# Find env/config files
ls .env* config/ *.config.* 2>/dev/null
Spawn a red team agent (use security-agent or general-purpose agent type) with this mission:
Red Team Directive: Think like an attacker. For each area found in Step 1, systematically check:
git log --all -p | grep -i "password\|secret\|api.key").env files or config with credentialsnpm audit, cargo audit, pip audit)Red Team Output Format:
## Red Team Findings
### CRITICAL
| # | Vulnerability | Location | Attack Vector | Impact |
|---|---------------|----------|---------------|--------|
### HIGH
| # | Vulnerability | Location | Attack Vector | Impact |
|---|---------------|----------|---------------|--------|
### MEDIUM
| # | Vulnerability | Location | Attack Vector | Impact |
|---|---------------|----------|---------------|--------|
### LOW
| # | Vulnerability | Location | Attack Vector | Impact |
|---|---------------|----------|---------------|--------|
Spawn a blue team agent with the red team findings. The blue team:
Blue Team Directive: For each red team finding, propose a concrete mitigation:
Blue Team Output Format:
## Blue Team Mitigations
| Finding # | Valid? | Mitigation | Effort | Code Patch Available? |
|-----------|--------|------------|--------|-----------------------|
For each valid finding, include:
### Mitigation for Finding #{N}: {title}
**Status**: Valid / False Positive / Needs Investigation
**Fix**:
```diff
{code diff}
Additional hardening: {extra measures}
### Step 4: AUDITOR — Verification Phase
Spawn an auditor agent with both red team findings and blue team mitigations:
**Auditor Directive:**
The auditor is the final arbiter. Key principle: **the reviewer must never be the author**.
1. **Verify red team findings are real** — Check each vulnerability claim
2. **Verify blue team fixes are sound** — Ensure patches don't introduce new issues
3. **Score final severity** — Assign CVSS-like scores (1-10)
4. **Rank by priority** — What to fix first
5. **Check for gaps** — Did the red team miss anything obvious?
**Auditor Output Format:**
```markdown
## Security Audit Report
**Date**: {date}
**Project**: {project name}
**Auditor**: Three-Agent Adversarial Pipeline
### Executive Summary
- Total findings: {N}
- Critical: {N} | High: {N} | Medium: {N} | Low: {N}
- False positives identified: {N}
- Fixes verified: {N}/{total}
### Prioritized Action Items
| Priority | Finding | Severity (1-10) | Fix Status | Effort |
|----------|---------|-----------------|------------|--------|
### Detailed Findings
{For each finding: red team attack + blue team fix + auditor verdict}
### Gaps Identified
{Anything the red team missed}
### Recommendations
{Strategic security improvements beyond individual fixes}
Display the final auditor report to the user. Offer:
fix — Apply all blue team patches that the auditor verifiedfix critical — Apply only critical/high severity fixesexport — Save report to docs/security-audit-{date}.mdissues — Create GitHub issues for each findingWhen processing external content (fetched URLs, user uploads, API responses):
After audit completion, significant findings are captured as knowledge notes.
Security fixes can be committed with conventional format: fix(security): {description}
Export report for CI pipeline integration:
# Run audit in CI mode (exits non-zero if critical findings)
# Save report as artifact
documentation
Report reflect drain spend over a time window — tokens split by cached (cache_read), uncached writes (cache_creation), and io (input+output), with a $ estimate, grouped by day / outcome / model / transcript. Reads the drainer's cost log and surfaces outlier runs and cache-reuse health (the 41.5M-token failure mode = low cache reuse + high cache writes). Use to answer "what is reflection costing me" for the last day / week.
development
Show fleet status — every claude session running on the host, merged across ainb + claude-peers broker + background jobs. Use when you need to enumerate sessions before composing an action, see which sessions have a peer registered (broker-routable) vs tmux-only, check the `summary` of each session, or pipe the list into jq for filtering. Default output: text table. Pass --format json for LLM consumption.
testing
Ordered multi-step prompts to fleet targets, ack-gated between steps via JSONL assistant-turn-end detection. Use for cycles like disconnect→reconnect→verify, or any flow where step N+1 requires step N to have completed first. The skill BLOCKS until each target's transcript shows the next assistant turn finishing OR per-step timeout fires (default 300s).
development
Center control panel — enumerate every claude session that is blocked waiting on something: a user answer (AskUserQuestion fired), an API error retry, an idle assistant turn-end with no follow-up, or an explicit WAITING: marker. Returns rich JSON with signal kind + context per session. Use this when you've stepped away from the fleet and want one place to see everything that wants your attention and answer it.