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-vectors127-ata-account-precreation-dos.md

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

127 — ATA / Account Pre-Creation DoS (Init Front-Running)

Severity: 6 | Real: recurring across Accretion, Sec3, and Neodyme reports

Account creation on Solana is permissionless: anyone can create an Associated Token Account for any (owner, mint) pair, or fund/allocate any address whose derivation is public. If a permissionless instruction hardcodes init (which requires the account to not already exist) on an account whose address an attacker can predict — most commonly an ATA, but any user-derivable PDA — the attacker simply creates that account first. The honest instruction then hits "account already in use" and reverts every time, with no path to recover. Because the target is fully determined by public inputs (owner + mint, or known seeds), the griefer can pre-create it the moment they see the victim intends to act (or pre-emptively for all likely victims), turning a one-time race into a durable denial of service on whatever flow depends on that init.

This is distinct from reinitialization (KV-014 / AV-023–024): the attack is not re-running init on live state, it is blocking the first init so the legitimate instruction can never complete. The fix is the mirror image — instead of guarding against re-init, tolerate the pre-existing account.

Verification Procedure

Step 1: Find init (not init_if_needed) on user-derivable accounts in permissionless instructions

grep -rn --include="*.rs" -E "init\b|associated_token::|init_if_needed" programs/*/src/
  • List every account created with plain init whose seeds/address depend only on public inputs (an ATA, or a PDA seeded by an attacker-known pubkey/mint)
  • Flag those reachable from an instruction any user can call without prior authorization

Step 2: Classify each — can an attacker pre-create the address?

grep -rn --include="*.rs" -E "get_associated_token_address|find_program_address|create_associated_token|ATA|Associated" programs/*/src/
  • ✅ PASS: the account is either created with init_if_needed plus explicit validation of its state (owner/mint/discriminator/initialized flag), or the instruction otherwise handles the already-exists case gracefully, or creation is gated behind a signer the attacker cannot impersonate
  • ❌ FAIL: plain init on an attacker-derivable account in a permissionless path — front-runnable to permanent revert

Step 3: Confirm the pre-existing path is safe, not just non-reverting

  • Where init_if_needed is used, verify the "already existed" branch re-validates the account so a pre-seeded/malicious account cannot smuggle attacker-chosen state into the flow (avoid trading a DoS for a reinit bug)
  • ✅ PASS: pre-existing accounts are fully re-validated before use; the attacker gains nothing by pre-creating
  • ❌ FAIL: init_if_needed accepts a pre-existing account without checking owner/authority/mint/flags

Overall verdict:

  • ✅: No permissionless init on an attacker-derivable account, OR init_if_needed + full state validation of the pre-existing case, OR the already-exists case is explicitly and safely handled (documented)
  • ⚠️: Uses init_if_needed but the pre-existing branch is only partially validated, or the risk is acknowledged but unmitigated
  • ❌: Plain init on an ATA / user-derivable account in a permissionless instruction — an attacker front-runs creation and permanently bricks the honest call
  • N/A: No on-chain program, or all init targets are non-predictable / gated behind an unforgeable signer

See also: not the same as KV-141 (init succeeds and captures admin) or KV-142 (pre-allocated init hijack).

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