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-vectors104-non-canonical-bump-pda-derivation-confusion.md

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

104 — Non-Canonical Bump / PDA Derivation Confusion

Severity: 7 | Real: Sealevel Attacks — "bump seed canonicalization"

find_program_address returns the canonical (highest valid) bump for a set of seeds. create_program_address accepts ANY bump and will succeed for multiple non-canonical bumps, yielding several valid PDAs for the same logical seeds. A program that accepts a user-supplied bump and derives with create_program_address (or Anchor seeds::bump without storing/reusing the canonical bump) lets an attacker create "shadow" accounts for the same entity — duplicate positions, parallel vaults, or bypassed one-per-user invariants.

Verification Procedure

Step 1: Find PDA derivations and bump handling

grep -rn --include="*.rs" -E "create_program_address|find_program_address|Pubkey::create_program_address|bump" programs/

Step 2: Flag user-supplied bumps fed to create_program_address

  • ✅ PASS: Bumps come from find_program_address / Anchor canonical bump and are stored in state, then reused via bump = account.bump
  • ❌ FAIL: An instruction argument bump is passed into create_program_address without proving it is canonical

Step 3: Verify stored-bump reuse on all subsequent access

grep -rn --include="*.rs" -E "bump = [a-z_]+\.bump|bump,\s*$" programs/*/src/instructions/
  • ✅ PASS: Every access after init uses the stored canonical bump
  • ❌ FAIL: Bump re-derived or re-supplied per call (allows non-canonical variant)
  • Bump provenance: classify the last element of every create_program_address seed list — instruction argument with no == find_program_address(..).1 comparison in the fn or its helpers (High); field of a Borsh-decoded instruction struct (High); account field (safe only if written from ctx.bumps/find_program_address at an init that used seeds + bare bump). A stored canonical bump with create_program_address is recommended, not a finding.
  • PoC recipe: enumerate b in 0..=255, keep bumps where create_program_address succeeds (about half), call create+claim per bump; fixed code allows exactly one (templates/poc/RECIPES.md).

Sources: crytic/solana-lints lints/bump_seed_canonicalization [paraphrased, cited: https://github.com/crytic/solana-lints]; Sealevel Sentinel (stantheman0128/sealevel-sentinel) src/detectors/bump-seed-canonicalization.ts (MIT, Copyright (c) 2026 Stan (stantheman0128)); Solana Foundation course content/courses/program-security/bump-seed-canonicalization.md [paraphrased, cited]; CDSecurity/cdsecurity-skills rust-audit-prep/references/checklist.md create_program_address row, corrected (MIT, Copyright (c) 2026 CD Security).

Step 4: Verify one-per-entity invariants hold under non-canonical bumps

  • For "one position per user", "one vault per fund", etc.: confirm a second non-canonical PDA cannot be initialized for the same seeds
  • ✅ PASS: init uses canonical seeds+bump; duplicates impossible
  • ❌ FAIL: Attacker can init a parallel account with a non-canonical bump

Overall verdict:

  • ✅: Canonical bumps only, stored and reused; no create_program_address with untrusted bump
  • ⚠️: Canonical at init but re-derived elsewhere (defense-in-depth gap)
  • ❌: User-supplied bump used in derivation — shadow PDAs possible

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