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.

known-vectors004-missing-access-control.md

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

4 — Missing Access Control

Severity: 10 | Real: Wormhole ($326M), Parity ($31M), numerous Solana rug pulls

Admin/privileged function doesn't verify the signer is authorized. Anyone can call it.

Verification Procedure

Step 1: List all instructions and their signers

grep -rn --include="*.rs" "pub fn\|Signer<'info>" programs/*/src/instructions/
  • Record: Every instruction function and how many Signer accounts it has

Step 2: For each instruction, verify signer constraints

grep -rn --include="*.rs" -A20 "#\[derive(Accounts)\]" programs/*/src/instructions/ | grep -E "Signer|has_one|constraint"
  • ✅ PASS: Every mutation instruction has at least one Signer<'info> with appropriate has_one or constraint
  • ❌ FAIL: Any mutation instruction without a signer check

Step 3: Verify has_one constraints match state fields

grep -rn --include="*.rs" "has_one" programs/*/src/instructions/
  • For each has_one = field, verify the referenced field exists in the account struct and is the correct authority
  • ✅ PASS: All has_one constraints reference valid authority fields
  • ❌ FAIL: Missing has_one on admin operations, or has_one references wrong field

Step 4: Check for runtime require_keys_eq (defense in depth)

grep -rn --include="*.rs" "require_keys_eq!\|require_eq!" programs/*/src/instructions/
  • ✅ PASS: Critical operations have BOTH declarative (has_one) AND runtime (require_keys_eq!) checks
  • ⚠️ PARTIAL: Only declarative OR only runtime (not both)

Step 5: Verify admin functions are admin-only

# List all functions that modify global state, program config, or treasury
grep -rn --include="*.rs" -iE "admin|config|treasury|authority|owner|upgrade|pause|freeze|withdraw_fee" programs/*/src/instructions/
  • For each: verify the signer is checked against the stored authority
  • ✅ PASS: Every admin function verifies signer == stored authority
  • ❌ FAIL: Any admin function callable by non-authority

Step 6: Check for unrestricted init/initialize

grep -rn --include="*.rs" "pub fn init\|pub fn initialize\|pub fn create" programs/*/src/instructions/
  • ✅ PASS: Init functions either check an authority that already exists (upgrade authority via a pinned ProgramData, a hard-coded admin, or a creator-namespaced PDA whose consumers resolve by the expected creator), or create only caller-scoped state (seeds include the caller)
  • ❌ FAIL: A singleton init (constant-only seeds) stores the caller as admin/fee recipient/oracle authority with no deployer gate — init makes it one-time, not who-first (KV-141); or an init can be called by anyone to overwrite state

Overall verdict:

  • ✅: Every instruction has correct signer + constraint checks, admin functions protected, init is one-time
  • ⚠️: Most instructions correct but 1-2 missing defense-in-depth
  • ❌: Any mutation instruction callable without proper auth

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