Index of every page on this site: llms.txt
All skills
princedotrs avatar

/solana-program-audit

@586e19e
Run it yourself

Security audit of Solana on-chain programs in Rust: Anchor, native solana-program and Pinocchio. Use to audit or review a Solana program, PR or fix and to find vulnerabilities: missing signer or owner checks, account validation, type cosplay, reinitialization, init front-running, closed-account revival, duplicate accounts, PDA seeds and bumps, arbitrary CPI, CPI return data, remaining_accounts, sysvar and instruction introspection, overflow, rounding, Token-2022 extensions and transfer hooks, oracle, flash-loan and MEV attacks, upgrade authority and governance. Covers DeFi reviews (AMM, lending, perps, staking, bridges, launchpads), PoC exploits, fix patches, re-audits, spec compliance, audit readiness, release gates and audit reports. Trigger on code using anchor_lang, solana_program, pinocchio, #[program], #[derive(Accounts)] or entrypoint!. Not for writing features, off-chain clients or backends, EVM/Solidity, or incident response.

  • 237 files
  • 2 MB
  • Updated 4 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/princedotrs/solana-audit/solana-program-audit

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

AGENTS.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Solana Program Audit — Agent Orchestration

This skill audits Solana on-chain programs (Rust / Anchor / native solana-program / Pinocchio) with a small team of subagents (see agents/) and, when they are installed separately, orchestrates the Trail of Bits execution skills.

Bundled paths. Every bundled path — scripts, tools, templates, corpus files — is relative to <skill-root>: the directory containing this skill's SKILL.md, never the audited repo, which is usually the working directory. Command and agent text writes that root as <skill-root> for what it runs and what it reads; substitute the absolute path before running or reading anything, and in a file read later, use the absolute root you were given (OUTPUT-RULES.md Rule 11e).

Flow (full audit)

  1. Pre-scan (optional, deterministic). If <skill-root>/tools/auditor-tools/ is built, audit-scan emits the instruction/constraint/PDA/arithmetic map at ~$0 and audit-mem warm --program-id <id> loads prior invariants + open false-positive rulings (Rule 11d: from an in-tree .audit-memory/ only if the auditor created it and GIT_NO_LAZY_FETCH=1 git --no-pager -c core.fsmonitor=false --icase-pathspecs ls-files -- .audit-memory prints nothing and exits 0, checked before mkdir -p .audit-memory && printf '*\n' > .audit-memory/.gitignore and before every audit-mem use; any output, in any letter case, or any error means a fresh store outside the tree, passed as --db <path outside the tree>) — seeding context-builder with a map instead of a blank repo, and letting vuln-hunter auto-suppress findings that carry a prior FALSE_POSITIVE ruling (audit-mem check). Falls back to the grep walk if the toolchain is absent. See references/orchestration/pre-scan.md.
  2. context-builder — Phase 0 setup + Phase 0.5 context reconstruction. No verdicts; understanding only. 1b. threat-modeler — from the context worksheets + audit_<n>/intake.md, emits audit_<n>/threat-model.md (asset inventory · actor×capability · trust boundaries) that hands the reviewers attacker goals and seeds report §4.4/§4.6/§4.7. When a bootstrap trigger fires (prior audit or incident, fork provenance, prior audits/incidents next to the target), the bundled collector (<skill-root>/scripts/threat-model/collect.sh, never a scripts/ path relative to the audited repo) first gathers history and prior reports offline into audit_<n>/bootstrap/; the agent stays read-only and cites that evidence per goal. No verdicts.
  3. vuln-hunter — item-by-item walk against in-scope checklists + phase-triggered vectors. Every finding with N ≥ 6 must pass the Rule 5b gate. Delegates SAST / harnesses to the Trail of Bits skills when installed (see references/orchestration/boundary-map.md).
  4. economic-analyst — checklist 06 + economic vectors; drives the economic-sim playbook (commands/economic-sim.md, Surfpool mainnet-fork) to quantify profitability for High/Critical economic findings.
  5. peer-reviewer — independent reconciliation on top-severity findings (N≥8, contested N≥7): re-derives from the code (reusing the context worksheets), delegates to Trail of Bits fp-check (local) and second-opinion when installed — second-opinion sends the selected code to an external LLM CLI (OpenAI Codex or Google Antigravity / Gemini), disclosed in the report per OUTPUT-RULES.md Rule 11b; emits CONFIRM / DISPUTE / DOWNGRADE. (Neodyme independent dual-review.)
  6. audit-reporter — deterministic assembly: Scope Coverage, findings, Phase 4.5 maturity scorecard, remediation roadmap → audit_<n>/REPORT.md.

Between review and reconciliation, the triage playbook (commands/triage.md) batch-dedups the candidate set (root-cause + audit-mem suppression/regression), re-applies Rule 5b, and splits real findings from Notes & Nitpicks. On demand for High/Critical findings, poc-engineer + patch-engineer (via the poc / patch playbooks, commands/poc.md / commands/patch.md, or the audit-cycle playbook with --with-poc) emit executable PoCs + verified fix patches (see references/orchestration/poc-harness.md).

Cheap lanes: the quick-scan and diff-audit playbooks (commands/quick-scan.md, commands/diff-audit.md) skip the full item-by-item walk.

Every agent that builds or runs target code — poc-engineer, patch-engineer, Trail of Bits harnesses when installed — uses the execution mode recorded at intake (OUTPUT-RULES.md Rule 11a); any outside service it contacts is listed in the report (Rule 11b).

Full-lifecycle flows: the audit-cycle playbook (commands/audit-cycle.md, fully automated → client report) and the audit-assist playbook (commands/audit-assist.md, human-in-the-loop, iterative); the re-audit playbook (commands/re-audit.md) for fix-review. See references/audit-lifecycle/methodology.md.

Trail of Bits (optional, installed separately)

Trail of Bits provides tool execution this skill cannot do in prose (CodeQL/Semgrep taint, fuzzing, coverage, mutation, IR-level zeroize/constant-time analysis). It is not bundled. If the Trail of Bits skills (https://github.com/trailofbits/skills, CC-BY-SA-4.0) are installed separately, subagents delegate per references/orchestration/boundary-map.md; otherwise they use the native grep checks in discovery/grep-commands.md and note the tooling gap in the report. It is a reference, not a copy — CC-BY-SA stays with Trail of Bits; this skill's own corpus is MIT. Methodology patterns re-implemented natively are credited in ATTRIBUTION.md.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 586e19e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 4 weeks ago

README badge

README badge for princedotrs/solana-audit