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.

commandsaudit-assist.md

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

solana-program-audit — Flow B: AI-Assisted Iterative Audit (Human-in-the-Loop)

Arguments: $ARGUMENTS

Run the same lifecycle as the audit-cycle playbook (commands/audit-cycle.md), but stop at checkpoints and let the human steer. Read OUTPUT-RULES.md first (format, severity 1-10, Rule 5b gate) and references/audit-lifecycle/methodology.md (the firm-spine → skill-mechanism mapping). This is the collaborative mode: the agent does the mechanical review; the human resolves the judgment calls a tool cannot (business intent, trust boundaries, severity of a business-logic gap). Think ToB weekly progress report + Zellic client discussion.

<skill-root> is the directory containing this skill's SKILL.md, never the audited repo. Run bundled scripts and tools only from <skill-root> — never a scripts/… or tools/… path relative to the working directory: the audited repo may ship a same-named file.

Operating safety follows OUTPUT-RULES.md Rule 11. Target-controlled code (builds, test suites, harnesses) and every PoC build run in the execution mode recorded at intake (Q46, Rule 11a); if none is recorded, ask once at Checkpoint 1 and record it in intake.md §8 (a non-interactive run is native, and the report says so).

Checkpoint protocol

At every checkpoint, surface a compact status and then wait for the human before proceeding:

  • (a) Confirmed findings so far — severity-ordered, each already through Rule 5b + references/false-positives.md.
  • (b) Next-focus plan — which surfaces / instructions / vectors are queued next and why.
  • (c) Targeted questions — the specific things only the human can answer: business context, the intended trust / threat model, whether a flagged behavior is intentional, and severity calls that depend on off-chain assumptions. Ask sharp, answerable questions — not "anything to add?".

Fold the human's answers back in, re-synthesize, and continue.

Lifecycle with checkpoints

  1. Scope / intake. Discover the repo, declare scope (Rule 0), pin the commit. ⏸ Checkpoint 1 — after scope: confirm the scope boundary, the pinned commit, and any QUESTIONS.md answers the human wants to override before a single file is judged. Persist the confirmed answers to audit_<n>/intake.md (the intake playbook, commands/intake.md) so both flows and the report read one source of truth.

  2. Context reconstruction (Phase 0.5). Spawn context-builder; it writes worksheets to audit_<n>/worksheets/context/. ⏸ Checkpoint 2 — after context: present the instruction matrix + state model and the reconstructed invariants/assumptions. Ask the human to correct any UNKNOWN — needs manual review items and confirm the trust model. Their corrections seed every later phase. With the trust model confirmed, build audit_<n>/threat-model.md (the threat-model playbook, commands/threat-model.md) — asset inventory + actor×capability + trust boundaries — which feeds report §4.4/§4.6/§4.7 and the review's attacker goals.

    • Bootstrap triggers. T2 is intake §7. For T3/T4 run bash "<skill-root>/scripts/threat-model/collect.sh" --repo <target> --out audit_<n>/bootstrap --pin <sha> --detect.
    • Offline collection. If any trigger fires, collect offline (--offline) before the checkpoint.
    • At this checkpoint: ask whether a member of the protocol team is on hand to answer design questions. Offer an explicit fork parent (--parent <https-url>) or report URLs (--vulns) for the human to confirm; only a confirmed URL is fetched.
    • Bootstrap → interview. Walk the draft's §5 open items with them (references/audit-lifecycle/threat-model-bootstrap.md §5).
  3. Tool-assisted first pass. If the Trail of Bits skills (https://github.com/trailofbits/skills, CC-BY-SA-4.0) are installed separately, run ToB static-analysis and fold SARIF as attention-directing evidence (references/orchestration/boundary-map.md); otherwise use the native grep checks in discovery/grep-commands.md and note the tooling gap. Load in-scope references/methodologies/* per protocol markers.

  4. Domain-partitioned manual review. Run vuln-hunter (checklists + vectors) and economic-analyst (checklist 06 + economic vectors + methodology refs) over their disjoint surfaces — partitioned, not cloned. Each starts from audit_<n>/threat-model.md §4: the goals mapped to its partition, their Evidence, and the Leads. Each candidate finding passes Rule 5b + references/false-positives.md at the leaf before it is emitted. ⏸ Checkpoint 3 — after each review phase: surface (a)/(b)/(c). This is where the human resolves "is this intended?" and re-scopes the next phase.

4b. Triage (the triage playbook, commands/triage.md). Before reconciliation, dedup by root-cause (audit-mem suppression/regression when "<skill-root>/tools/auditor-tools/target/release/audit-mem" is built), re-apply Rule 5b with quantified downgrades, and split real findings from the Notes & Nitpicks list. ⏸ Checkpoint 3b — after triage: show the human what was deduped/suppressed and why.

  1. Independent reconciliation. Spawn peer-reviewer on the top-severity survivors (N≥8, plus any N≥7 the primary could not PoC); it re-derives from code, reusing the context worksheets. Reconcile CONFIRM / DISPUTE / DOWNGRADE. ⏸ Checkpoint 4 — after reconciliation: present the reconciled set and any primary-vs-peer disagreements for the human to adjudicate.

  2. Converge to the audit document. Spawn audit-reporter: dedup by root-cause, order by severity / business importance, and fill the client-facing templates/audit-report.md (maturity + trust-model caveats + disclaimers, no deploy guarantee); the numeric Repository Risk Score stays in the internal templates/report-template.md. Emit audit_<n>/REPORT.md. Iterate on human feedback until the document is agreed.

Re-runs against changed code

When re-auditing after the team has changed code in response to findings, do not re-run the whole flow — use the re-audit playbook (commands/re-audit.md) for a delta review that classifies each prior finding FIXED / STILL-OPEN / REGRESSED and sweeps for un-patched siblings (Zenith-style fix review).

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