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.

commandspoc.md

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

solana-program-audit — Executable Proof-of-Concept

Arguments: $ARGUMENTS

Turn a confirmed finding into a runnable exploit. Read OUTPUT-RULES.md first (severity 1-10, the Rule 5b gate — the finding must already carry a filled Reachability + Math/State-Bounds block, Attacker-Model for N≥7) and references/orchestration/poc-harness.md (the finding-type → framework matrix and the [PoC-*] evidence tiers this command emits). A PoC is evidence that upgrades an asserted finding to a demonstrated one — it never invents a finding that Rule 5b did not already confirm.

Steps

  1. Resolve the finding. Locate the target: a finding id (F-xxx) resolved from the latest audit_<n>/REPORT.md, or a raw file:line — read its full finding block and its context worksheet under audit_<n>/worksheets/context/*. Pin the commit the report names — the harness reproduces that commit, never HEAD.

  2. Severity gate. By default only High/Critical (N≥7) findings earn an executable PoC — a runnable exploit is the Rule 5b PoC those severities demand, and spending the harness budget on low-severity items is waste. --force overrides the gate for a deliberately-requested lower-severity demonstration. A finding still at [UNCONFIRMED] / [PARTIAL] is not eligible — confirm it through Rule 5b first.

  3. Detect the toolchain (never assume). Probe what is actually installed, from a directory outside the target tree (cd "${TMPDIR:-/tmp}" first): inside it, the target's .cargo/config* can alias build-sbf to its own code and its rust-toolchain* can swap in its own cargo.

    • cargo build-sbf --version (SBF program build),
    • surfpool MCP reachable (mainnet-fork execution),
    • trident --version / cargo fuzz --version on PATH (coverage-guided fuzzing). Record which are present. A missing tool is a blocker to name, not a reason to fabricate.
  4. Pick the framework by finding type (matrix in references/orchestration/poc-harness.md):

    • logic / access-control / signer / owner / PDA / CPI → Mollusk single-instruction harness (fastest, deterministic, one process_instruction).
    • multi-step lifecycle (init → mutate → withdraw, cross-instruction state) → LiteSVM stateful sequence.
    • economic / oracle / MEV → Surfpool mainnet-fork (--fork) — reproduce deposit→manipulate→withdraw against forked pool state for a real P/L figure.
    • fuzz-discoverable parse / deser / math → Trident / cargo-fuzz (--fuzz) — emit the fuzz target that finds the crashing input. --fork / --fuzz force the Surfpool / fuzz path respectively when the finding type is ambiguous.
  5. Spawn poc-engineer. Hand it the finding block, the context worksheet, the pinned commit, the chosen framework, the detected toolchain, and the execution mode recorded for the run (audit_<n>/intake.md §8; OUTPUT-RULES.md Rule 11a). If no mode is recorded, ask once (a non-interactive run is native, and the report says so) and pass it on as AUDITOR_EXEC_MODE. poc-engineer copies the matching crate from "<skill-root>/templates/poc/" (<skill-root> is the directory containing this skill's SKILL.md, never the audited repo) — never a relative templates/ path, which would resolve inside the audited repo — and fills it: a feature-gated vulnerable arm the exploit succeeds against, leaving its effect, and a fixed arm it is rejected against with the guard's exact error (assert_exploit_effect! / assert_exploit_rejected_with! from our shared-test-utils). The exploit test must assert the vulnerability, not merely run.

  6. Emit outputs under audit_<n>/poc/F-xxx/:

    • the filled harness crate (copied from "<skill-root>/templates/poc/"),
    • a one-command run.sh that reproduces the result from a clean checkout: the template's own for its crate (cargo test), or one poc-engineer writes for a trident fuzz or cargo fuzz target or the surfpool scenario. Every runner needs AUDITOR_EXEC_MODE set to the run's recorded mode (OUTPUT-RULES.md Rule 11a) and otherwise exits 3 → [PoC-ATTEMPTED] before it copies or compiles anything; a runner poc-engineer writes starts with the template run.sh's mode gate, verbatim (the lines are in references/orchestration/poc-harness.md §1). No runner builds inside the target tree: each copies the crate to a scratch directory outside it (printed) with the toolchain pinned,
    • the earned [PoC-*] evidence tier recorded against the finding (see vocabulary below), which audit-cycle / re-audit fold back into the report's finding block.

Evidence tiers (emit exactly one)

Tier Meaning
[PoC-REPRODUCED] The exploit ran and asserted the flaw — succeeds on the vulnerable arm, rejected on the fixed arm (Mollusk / LiteSVM).
[PoC-SIM-REPRODUCED] Reproduced against a Surfpool mainnet-fork with a recorded net P/L (economic / oracle / MEV).
[PoC-FUZZ-REPRODUCED] A Trident / cargo-fuzz target produced the crashing / invariant-breaking input; the corpus entry is saved.
[PoC-ATTEMPTED] A required tool was absent (no cargo build-sbf, surfpool unreachable, fork state unavailable), the recorded execution mode could not run it, or the flaw could not be minimized into a self-contained crate. Name the exact blocker, keep the existing prose PoC, and record what a maintainer must install/provide to promote it.

Never hard-fail

On any toolchain absence or minimization failure, emit [PoC-ATTEMPTED] with the named blocker and preserve the finding's existing structured attacker-narrative PoC — a prose PoC is a first-class Rule 5b proof form. Downgrading the evidence tier never downgrades the finding's severity. Do not fabricate a passing test to reach [PoC-REPRODUCED]; an asserted-only-in-prose finding is honest, a faked green test is not.

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