Help us improve
Share bugs, ideas, or general feedback.
From solana-audit
Audits Solana smart contracts for security vulnerabilities and exploits using multi-agent scanning on Rust code with solana_program or anchor_lang.
npx claudepluginhub workersio/specHow this skill is triggered — by the user, by Claude, or both
Slash command
/solana-audit:solana-auditThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Activate this skill when the user asks to:
references/CHEATSHEET.mdreferences/account-closure-vulnerability.mdreferences/account-not-initialized.mdreferences/agents/adversarial-scanner.mdreferences/agents/auth-state-scanner.mdreferences/agents/cpi-math-scanner.mdreferences/agents/explorer.mdreferences/agents/framework-scanner.mdreferences/agents/logic-economic-scanner.mdreferences/anchor-specific.mdreferences/arbitrary-cpi-target.mdreferences/audit-checklist.mdreferences/division-precision-loss.mdreferences/duplicate-mutable-accounts.mdreferences/exploit-case-studies.mdreferences/instruction-access-control.mdreferences/integer-overflow-underflow.mdreferences/missing-authority-validation.mdreferences/missing-bump-canonicalization.mdreferences/missing-owner-check.mdScans Solana programs for 6 critical vulnerabilities including arbitrary CPI, improper PDA validation, missing signer/ownership checks, and sysvar spoofing. Use when auditing Solana/Anchor programs.
Audits Solana programs in Anchor or native Rust for security vulnerabilities via 5-step process: account validation, arithmetic safety, PDA checks, CPI security, and exploit patterns detection.
Audits Solana programs using Anchor or native Rust for security vulnerabilities including account validation, arithmetic safety, PDA issues, CPI risks, and common exploits like type cosplay. Use for smart contract reviews and assessments.
Share bugs, ideas, or general feedback.
Activate this skill when the user asks to:
solana_program, anchor_lang, pinocchio, #[program], or #[derive(Accounts)]Before scanning, establish the audit scope and check for prior data.
Step 1 — Ask the user 3 configuration questions (skip if user says "just audit it" or equivalent):
Step 2 — Store configuration:
If ${CLAUDE_PLUGIN_DATA} is available:
${CLAUDE_SKILL_DIR}/references/templates/config-template.json for the schema${CLAUDE_PLUGIN_DATA}/config.json${CLAUDE_PLUGIN_DATA}/audit-log.jsonl — if it exists and contains entries for the same program, inform the user: "Found prior audit from [date]. [N] findings were reported."${CLAUDE_PLUGIN_DATA}/accepted-risks.json — if it exists, load accepted risks to cross-reference during Phase 3If ${CLAUDE_PLUGIN_DATA} is not available, proceed without persistence. Do not error or warn — just skip silently.
Defaults (if user skips configuration): scope=all programs, depth=standard, no known constraints.
Read references/agents/explorer.md and spawn the explorer agent using the Agent tool.
How to construct the agent call:
${CLAUDE_SKILL_DIR}/references/agents/explorer.md. The agent prompt is the text between the triple-backtick fences in the ## Agent Prompt section.[Insert: repository path or "full codebase scan"] with the actual target path (from Phase 0 scope, or the repo root).Agent(subagent_type="Explore", prompt="<the filled-in prompt>")
It returns: program map, instruction list, account structures, PDA map, CPI graph, protocol type classification, LOC count, and threat model.
You MUST spawn this agent and wait for its output before proceeding. The explorer output is passed to every scanning agent as shared context.
After the explorer agent returns, determine the program size and select the scan strategy:
| Size | Criteria | Scan Strategy |
|---|---|---|
| Small | <500 LOC AND <5 instructions | Single combined scan agent covering all categories (A through R). Construct one prompt inline that includes all vulnerability checks from the CHEATSHEET. No separate agent files needed. |
| Medium | 500–2000 LOC | Standard 4-agent parallel scan (Phase 2 below) |
| Large | >2000 LOC | Standard 4-agent parallel scan. Inform the user: "This is a large program. Consider running with depth: deep for adversarial cross-validation." |
For small programs, construct a single agent prompt that:
${CLAUDE_SKILL_DIR}/references/scoring.md for scoring rules${CLAUDE_SKILL_DIR}/references/CHEATSHEET.md for all 30 vulnerability typesFor medium and large programs, proceed to Phase 2.
Before spawning the scanner agents, run the consolidated syntactic scan:
${CLAUDE_SKILL_DIR}/references/scripts/scan-commands.mdPass the syntactic scan results to ALL scanner agents with this note prepended to their context:
Pass 1 (syntactic scan) has been completed by the orchestrator. Results below. Proceed directly to Pass 2 — Semantic Review.
[paste syntactic scan results here, organized by category]
This eliminates redundant grep work across 4 agents.
Read references/scoring.md for the confidence scoring rules and False Positive Gate. Then read all 4 agent prompt files and spawn them IN PARALLEL using 4 simultaneous Agent tool calls.
How to construct each agent call:
${CLAUDE_SKILL_DIR}/references/agents/auth-state-scanner.md). The prompt is everything between the triple-backtick fences in the ## Agent Prompt section.[INSERT EXPLORER OUTPUT HERE — the full codebase analysis from the explorer agent] with the literal full text output from the explorer agent.[references/scoring.md]) with absolute file paths using ${CLAUDE_SKILL_DIR} as the base (e.g., ${CLAUDE_SKILL_DIR}/references/scoring.md) so the agent can Read them directly — do NOT paste file contents inline.Auth Scanner (references/agents/auth-state-scanner.md)
CPI Scanner (references/agents/cpi-math-scanner.md)
Logic Scanner (references/agents/logic-economic-scanner.md)
Framework Scanner (references/agents/framework-scanner.md)
Spawn all 4 in a single response:
Agent(prompt="<auth-state-scanner prompt with explorer output + syntactic scan results inserted>")
Agent(prompt="<cpi-math-scanner prompt with explorer output + syntactic scan results inserted>")
Agent(prompt="<logic-economic-scanner prompt with explorer output + syntactic scan results inserted>")
Agent(prompt="<framework-scanner prompt with explorer output + syntactic scan results inserted>")
Each agent returns candidates with taxonomy ID, file:line, evidence, attack path, confidence score, and FP gate result.
DEEP mode (when user requests thorough/deep audit or depth=deep in config): After the 4 scanners complete, also spawn a 5th adversarial agent per references/agents/adversarial-scanner.md. Pass it the explorer output AND the merged scanner findings for cross-validation.
accepted-risks.json was loaded in Phase 0, cross-reference each finding by taxonomy_id + file. Mark matching findings as "Previously Accepted" with the stored reason. Still include them in the report but do not count them as new findings.For Anchor programs, also consult references/anchor-specific.md for framework-specific gotchas.
Produce the final audit report. Every finding MUST include its taxonomy ID from references/vulnerability-taxonomy.md and its confidence score.
If there are one or more findings, use the standard report template:
# 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 0: Scope configuration and prior audit check
- Phase 1: Codebase exploration (program map, CPI graph, threat model)
- Phase 2: Pre-scan syntactic analysis + parallel scan — 4 agents across 30 vulnerability types across 7 categories
- Phase 3: Merge, deduplicate by root cause, accepted risk check, 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)
```
### [HIGH] VULN-002: Title (Confidence: 80/100)
**File:** path/to/file.rs:line
**Category:** S-7 (Reinitialization)
...
---
### Below Confidence Threshold
---
### [MEDIUM] VULN-003: Title (Confidence: 60/100)
**File:** path/to/file.rs:line
**Category:** M-2 (Division Precision Loss)
**Description:** ...
**Impact:** ...
*(No fix recommendation — below confidence threshold)*
## Summary Table
| 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 |
## Appendix
- Complete file listing reviewed
- Vulnerability taxonomy reference
- Explorer output (program map, CPI graph, threat model)
If there are zero findings (clean audit), use this alternative template:
# Security Audit Report: [Program Name]
## Executive Summary
- **Result: No vulnerabilities identified**
- Audit date, scope (files, instructions, LOC)
- Framework: Native / Anchor / Pinocchio
- Protocol type: [from explorer classification]
- Methods: Parallel agent scan (4 agents), confidence-scored validation
- Finding counts: 0 Critical, 0 High, 0 Medium, 0 Low, 0 Informational
## Methodology
- Phase 0: Scope configuration and prior audit check
- Phase 1: Codebase exploration (program map, CPI graph, threat model)
- Phase 2: Pre-scan syntactic analysis + parallel scan — 4 agents across 30 vulnerability types across 7 categories
- Phase 3: Merge, deduplicate, devil's advocate falsification
- Phase 4: Confidence-scored report
## Categories Reviewed
All 7 categories (30 vulnerability types) were scanned:
| Category | IDs | Types Checked | Findings |
|----------|-----|---------------|----------|
| A: Authentication & Authorization | A-1..A-5 | 5 | 0 |
| S: Account & State Management | S-1..S-8 | 8 | 0 |
| C: Cross-Program Invocation | C-1..C-3 | 3 | 0 |
| M: Arithmetic & Math | M-1..M-4 | 4 | 0 |
| L: Logic & Economic | L-1..L-4 | 4 | 0 |
| T: Token-Specific | T-1..T-3 | 3 | 0 |
| R: Runtime & Deployment | R-1..R-3 | 3 | 0 |
## Scope
- Files reviewed: [list]
- Instructions analyzed: [count]
- Lines of code: [LOC]
## Disclaimer
A clean audit report does not guarantee the absence of vulnerabilities. This audit covers the 30 vulnerability types in the solana-audit taxonomy and is limited to static analysis of the on-chain program source code. It does not cover:
- Off-chain components (frontends, keepers, bots)
- Economic modeling or game-theoretic analysis beyond basic checks
- Deployment configuration (actual on-chain upgrade authority, program data account state)
- Vulnerabilities outside the taxonomy scope
- Bugs introduced after the audit date
## Appendix
- Complete file listing reviewed
- Vulnerability taxonomy reference
- Explorer output (program map, CPI graph, threat model)
Report rules:
**Category:** line with the taxonomy ID (e.g., A-1, S-7, C-1)**Confidence:** scoreSigner<'info>, Account<'info, T>, close = destination)After generating the report, persist the results if ${CLAUDE_PLUGIN_DATA} is available:
${CLAUDE_SKILL_DIR}/references/templates/audit-log-schema.md for the schema${CLAUDE_PLUGIN_DATA}/audit-log.jsonl with: timestamp, program name, path, framework, protocol type, LOC, instruction count, depth, finding counts by severity, finding IDs, and taxonomy IDsIf ${CLAUDE_PLUGIN_DATA} is not available, skip silently.
For CRITICAL or HIGH findings involving arithmetic safety (M-1, M-2, M-3, M-4), state invariants (S-1 through S-8), or authorization logic (A-1 through A-5), suggest formal verification using /kani-proof:
Formal verification available: Finding VULN-NNN ([taxonomy_id]: [title]) in
[function_name()]could be formally verified using/kani-proofto prove the fix is correct and the vulnerability cannot recur.
Example: "Finding VULN-001 (M-1: Integer Overflow) in calculate_reward() could be formally verified using /kani-proof to prove all arithmetic operations are safe under bounded inputs."
This is a lightweight recommendation only — do not block the report on it.
The references/ directory contains:
Core references:
Scan automation:
Persistence templates:
20 individual vulnerability files — Each with preconditions, vulnerable patterns, detection heuristics, false positives, and remediation
Agent prompts (references/agents/):
Protocol-specific references (references/protocols/) — loaded on-demand based on explorer classification: