Loading...
Loading...
Structured Solana smart contract security audit using parallel scanning agents with confidence-scored findings. Use when the user asks to audit, review, or analyze a Solana program for security vulnerabilities, or when code contains solana_program, anchor_lang, pinocchio,
npx skill4agent add workersio/spec solana-auditsolana_programanchor_langpinocchio#[program]#[derive(Accounts)]Agent(subagent_type="Explore", prompt="<paste explorer prompt from explorer.md, filling in the target path>")Agent(prompt="<auth-state-scanner prompt with explorer output inserted>")
Agent(prompt="<cpi-math-scanner prompt with explorer output inserted>")
Agent(prompt="<logic-economic-scanner prompt with explorer output inserted>")
Agent(prompt="<framework-scanner prompt with explorer output inserted>")# Security Audit Report: [Program Name]
## Executive Summary
- Audit date, scope (files, instructions, LOC)
- Framework: Native / Anchor / Pinocchio
- Protocol type: [from explorer classification]
- Methods: Parallel agent scan (4 agents + adversarial), confidence-scored validation
- Finding counts by severity: X Critical, Y High, Z Medium, W Low, V Informational
- Confidence threshold: 75/100
## Methodology
- Phase 1: Codebase exploration (program map, CPI graph, threat model)
- Phase 2: Parallel scan — 4 agents across 30 vulnerability types across 7 categories
- Phase 3: Merge, deduplicate by root cause, devil's advocate falsification
- Phase 4: Confidence-scored report
- Reference: vulnerability taxonomy based on Wormhole, Cashio, Mango, Neodyme, Crema exploits
## Findings
### [CRITICAL] VULN-001: Title (Confidence: 95/100)
**File:** path/to/file.rs:line
**Category:** A-1 (Missing Signer Check)
**Description:** ...
**Attack Path:** caller → instruction → state change → impact
**Impact:** ...
**Recommendation:** ...
**Fix:**
```rust
// Remediation code (framework-specific)| ID | Title | Severity | Category | Confidence | File | Status |
|---|---|---|---|---|---|---|
| VULN-001 | Missing Signer Check | Critical | A-1 | 95 | lib.rs:16 | Open |
| VULN-002 | Reinitialization | High | S-7 | 80 | lib.rs:11 | Open |
| --- | Below Confidence Threshold | --- | --- | <75 | --- | --- |
| VULN-003 | Division Precision Loss | Medium | M-2 | 60 | math.rs:45 | Open |
**Report rules:**
- Every finding MUST have a `**Category:**` line with the taxonomy ID (e.g., A-1, S-7, C-1)
- Every finding MUST have a `**Confidence:**` score
- Findings >= 75 confidence MUST include framework-specific fix code
- Findings < 75 appear below the **Below Confidence Threshold** separator without fix code
- Sort by confidence descending within each severity group
- The Summary Table MUST include the Category and Confidence columns
- Recommendations MUST include framework-specific fixes (e.g., `Signer<'info>`, `Account<'info, T>`, `close = destination`)
## References
The `references/` directory contains:
**Core references:**
- **[CHEATSHEET.md](references/CHEATSHEET.md)** — Condensed quick-lookup for all 30 vulnerability types with grep-able keywords (load this first)
- **[scoring.md](references/scoring.md)** — False Positive Gate + confidence scoring rules (loaded by all agents)
- **[vulnerability-taxonomy.md](references/vulnerability-taxonomy.md)** — Full index linking to individual vulnerability reference files
- **[audit-checklist.md](references/audit-checklist.md)** — Per-instruction validation checklist + syntactic grep commands
- **[anchor-specific.md](references/anchor-specific.md)** — Anchor framework-specific gotchas
- **[exploit-case-studies.md](references/exploit-case-studies.md)** — Real-world Solana exploit patterns ($500M+ in losses)
**20 individual vulnerability files** — Each with preconditions, vulnerable patterns, detection heuristics, false positives, and remediation
**Agent prompts** (`references/agents/`):
- **[explorer.md](references/agents/explorer.md)** — Phase 1 exploration
- **[auth-state-scanner.md](references/agents/auth-state-scanner.md)** — Auth Scanner (Categories A + S)
- **[cpi-math-scanner.md](references/agents/cpi-math-scanner.md)** — CPI Scanner (Categories C + M)
- **[logic-economic-scanner.md](references/agents/logic-economic-scanner.md)** — Logic Scanner (Categories L + T)
- **[framework-scanner.md](references/agents/framework-scanner.md)** — Framework Scanner (Framework + R)
- **[adversarial-scanner.md](references/agents/adversarial-scanner.md)** — DEEP mode threat modeling
**Protocol-specific references** (`references/protocols/`) — loaded on-demand based on explorer classification:
- **[lending-protocol.md](references/protocols/lending-protocol.md)** — Collateral, liquidation, interest rate patterns
- **[dex-amm-protocol.md](references/protocols/dex-amm-protocol.md)** — Swap, LP token, AMM curve patterns
- **[staking-protocol.md](references/protocols/staking-protocol.md)** — Reward distribution, epoch, delegation patterns
- **[bridge-protocol.md](references/protocols/bridge-protocol.md)** — Message verification, replay, guardian patterns