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-vectors144-self-referential-seeds-gating-objects.md

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

144 — Self-Referential Seeds & Permissionless Gating Objects

Severity: 8 | Real: Ackee Solana Auditors Bootcamp pda-privileges, CTF level-3 (faction gate) and level-5 (guardian set) drains

Two false assurances that baseline has_one items (AC-003/007, AV-020/075) do not name:

  1. Self-referential seeds. seeds = [b"vault", vault.owner.as_ref()], bump = vault.bump derives from fields stored in the account being validated. It passes for every account the program ever created with that layout: it proves the PDA is genuine, not that it is the caller's. If the handler then signs as that PDA or pays the signer, any user can act on any other user's PDA.
  2. Permissionless gating objects. A gate that checks "member of a faction / approved by a guardian set / listed in a market" passes when the attacker can create their own faction, mint, guardian set or market. The gate must pin the intended instance.

Cross-ref: PDA-023, AC-003, KV-143, KV-145.

Verification Procedure

Step 1: Seeds that reference the constrained account's own fields

rg -n -A4 '#\[account\(' programs/ | rg 'seeds\s*=\s*\[[^]]*\b([a-z_]+)\.[a-z_]+(\.key\(\))?\.as_ref\(\)'
rg -n -A3 'signer_seeds|with_signer|new_with_signer' programs/ | rg '\.(creator|owner|authority|recipient|user)\.as_ref\(\)'

Confirm the referenced object is the field being constrained (self-reference).

Step 2: Binding

  • ✅ PASS: the seed is derived from the Signer (seeds = [b"vault", caller.key().as_ref()]), or the stored field is bound (has_one = owner with owner: Signer, or constraint = vault.owner == caller.key())
  • ❌ FAIL: self-referential seed + value move or privileged state change + no signer binding

Step 3: Gating objects

  • For each gate, ask: can the attacker create their own instance of the gating object? If yes, ✅ PASS only if the gate pins the instance through stored or global state (address = config.faction, seeds including a trusted key).
// VULNERABLE: any genuine vault passes; the signer is never tied to vault.owner
#[account(seeds = [b"vault", vault.owner.as_ref()], bump = vault.bump)]
pub vault: Account<'info, Vault>,
pub caller: Signer<'info>,

// FIXED (either)
#[account(seeds = [b"vault", caller.key().as_ref()], bump = vault.bump)]
pub vault: Account<'info, Vault>,
// or
#[account(seeds = [b"vault", vault.owner.as_ref()], bump = vault.bump, has_one = owner)]
pub vault: Account<'info, Vault>,
pub owner: Signer<'info>,

Overall verdict:

  • ✅: every self-referential PDA and gate is bound to the caller / intended instance
  • ❌: a genuine-but-foreign PDA or a self-made gating object passes

Sources: Ackee-Blockchain Solana-Auditors-Bootcamp Lesson-6/pda-privileges, Capture-the-Flag/level-3 and Capture-the-Flag/level-5 [paraphrased, no licence, cited: https://github.com/Ackee-Blockchain/Solana-Auditors-Bootcamp/tree/master], narrowed to the two new angles.

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