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-vectors007-mev-sandwich-attack.md

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

7 — MEV Sandwich Attack

Severity: 7 | Real: Jaredfromsubway ($40M+ extracted, 2023), sandwich bots on Solana

Front-run user's swap → user gets worse price → back-run to capture the difference.

Verification Procedure

Step 1: Find all swap/trade operations

grep -rn --include="*.rs" -iE "swap|trade|exchange|jupiter|route|slippage" programs/
  • Record: Every instruction that performs or triggers a swap

Step 2: Verify slippage protection

grep -rn --include="*.rs" "slippage_bps\|min_out\|minimum_amount_out\|max_slippage\|slippage_tolerance" programs/
  • ✅ PASS: Every swap has a minimum_amount_out or slippage_bps parameter that is validated on-chain
  • ❌ FAIL: Swaps execute without minimum output validation

Step 3: Check slippage is enforced on-chain (not just in API call)

grep -rn --include="*.rs" -A10 "slippage\|min_out" programs/*/src/instructions/
  • ✅ PASS: require!(received >= minimum_amount_out, Error) check exists in the instruction
  • ❌ FAIL: Slippage only checked off-chain or in the API request but not in the program

Step 4: Verify slippage is set by the authorized party (not attacker)

# Check who provides the slippage parameter
grep -rn --include="*.rs" -B20 "slippage" programs/*/src/instructions/ | grep "Signer\|authority\|manager"
  • ✅ PASS: Slippage set by fund manager/authorized signer, not by an arbitrary account
  • ❌ FAIL: Any account can set the slippage tolerance

Step 5: Check backend slippage defaults

grep -rn --include="*.ts" -iE "slippage|slippageBps" apps/backend/
  • ✅ PASS: Backend uses reasonable slippage (50-300 bps) and doesn't allow user to set 10000 bps (100%)
  • ❌ FAIL: Slippage is hardcoded to a very high value or user-controllable without bounds

Overall verdict:

  • ✅: On-chain slippage enforcement, reasonable defaults, authorized signer controls it
  • ⚠️: Slippage exists but only enforced off-chain or defaults are too loose
  • ❌: No slippage protection on swaps

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