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-vectors002-flash-loan-price-manipulation.md

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

2 — Flash Loan Price Manipulation

Severity: 10 | Real: Euler ($197M), Mango Markets ($114M), Cream ($130M)

Borrow millions in one tx → manipulate price/collateral calculation → deposit/withdraw at wrong value → repay loan. Zero capital needed.

Verification Procedure

Step 1: Identify all price calculation code

grep -rn --include="*.rs" -iE "price|value|nav|collateral|balance.*amount|get_account_lamports" programs/
  • Record: List every file:line where asset values are computed

Step 2: Check if prices come from on-chain vs oracle

grep -rn --include="*.rs" -iE "pyth|switchboard|oracle|price_feed|price_account" programs/
  • ✅ PASS (if oracle used): Price comes from a hardened oracle with TWAP, not spot price
  • ❌ FAIL: Price calculated from current pool reserves or token account balance (manipulable)

Step 3: Check for deposit-to-withdrawal delay

grep -rn --include="*.rs" -iE "deposit.*time|withdrawal.*delay|lock.*period|cooldown|min_holding" programs/
  • ✅ PASS: There's a time delay between deposit and withdrawal (prevents same-tx manipulation)
  • ❌ FAIL: Deposit and withdraw can happen in the same transaction or same slot

Step 4: Check if balance is read before AND after state changes

# Look for patterns where balance is read, then state is changed, without re-reading
grep -rn --include="*.rs" -B5 -A5 "token_account.*amount\|get_lamports()" programs/*/src/instructions/
  • ✅ PASS: Balance snapshots are taken at consistent points, not between state changes
  • ❌ FAIL: Balance read can be stale or manipulated between CPI calls

Step 5: Verify NAV calculation atomicity (vault/fund protocols)

grep -rn --include="*.rs" "nav\|attestation\|total_value\|compute_shares" programs/
  • ✅ PASS: NAV is attested off-chain and verified on-chain with freshness timestamp
  • ⚠️ PARTIAL: NAV calculated on-chain but has staleness protection
  • ❌ FAIL: NAV uses current token account balances that could be donated to

Step 6: Check for flash loan integration or entry points

grep -rn --include="*.rs" "flash\|loan\|borrow\|CpiContext" programs/ | grep -v "test"
  • Record: Whether the program interacts with any lending protocol or could be called within a flash loan

Overall verdict:

  • ✅: Price calculation is oracle-based with TWAP, deposit/withdrawal delay exists, NAV has freshness protection
  • ⚠️: Some protections but not comprehensive (e.g., delay exists but no oracle TWAP)
  • ❌: Prices come from manipulable sources AND no time delays exist

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