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-vectors025-compute-budget-exhaustion-dos.md

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

25 — Compute Budget Exhaustion DoS

Severity: 6 | Real: Solana DeFi state bloat attacks, Mango Markets exploit chain

Attacker creates hundreds of positions/accounts — batch operations exceed 1.4M compute units, locking the protocol.

Verification Procedure

Step 1: Find all loops and iterations

grep -rn --include="*.rs" -iE "for.*in\|iter()\|remaining_accounts.*for\|\.len()" programs/*/src/instructions/
  • Record: Every loop with what's being iterated

Step 2: Check for bounded iteration

# For each loop: is there a max count?
grep -rn --include="*.rs" -B5 "for.*in\|iter()" programs/*/src/instructions/ | grep -iE "max\|limit\|cap\|MAX_"
  • ✅ PASS: All loops have explicit upper bounds (e.g., for i in 0..min(len, MAX_POSITIONS))
  • ❌ FAIL: Loop iterates over unbounded user-controlled collection

Step 3: Check remaining_accounts usage

grep -rn --include="*.rs" "ctx.remaining_accounts" programs/*/src/instructions/
  • ✅ PASS: remaining_accounts length is bounded and validated
  • ❌ FAIL: Unbounded remaining_accounts processed in loop

Step 4: Check for user-created account limits

grep -rn --include="*.rs" -iE "max_positions\|max_investors\|max_.*count\|capacity" programs/*/src/state/
  • ✅ PASS: Hard cap on user-creatable entities per fund/protocol
  • ❌ FAIL: Unlimited positions/accounts can be created

Step 5: Estimate worst-case compute

# If program processes N accounts in a loop, with ~50K CU per iteration:
# Max = 1,400,000 CU → safe with ~28 iterations at 50K each
# Check if worst case exceeds budget
  • ✅ PASS: Worst-case iteration * CU-per-iteration is well within 1.4M CU
  • ❌ FAIL: Worst case can exceed compute budget

Overall verdict:

  • ✅: Bounded loops, capped entities, safe compute budget
  • ⚠️: Bounded but close to compute limit in worst case
  • ❌: Unbounded iterations that can exceed compute budget

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