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-vectors107-fake-non-canonical-associated-token-account.md

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

107 — Fake / Non-Canonical Associated Token Account (ATA)

Severity: 8 | Real: ATA-assumption class — programs that trust "a token account for owner X" instead of THE canonical ATA

A wallet can hold many token accounts for the same (owner, mint) pair; only one is the canonical Associated Token Account (deterministically derived from the Associated Token Program). Two mistakes are common and exploitable:

  1. The program assumes a passed token account is the owner's ATA without deriving it — an attacker passes a different token account they control to redirect credits/airdrops/refunds.
  2. The program derives an ATA and assumes it exists / is initialized / is not frozen, or assumes the wrong token program (classic vs Token-2022) for derivation.

This is distinct from KV-016 (mint/authority mismatch): here the mint and owner can be correct, but the account is not the canonical ATA the protocol's off-chain/accounting layer expects.

Verification Procedure

Step 1: Find ATA assumptions

grep -rn --include="*.rs" -iE "associated_token|get_associated_token_address|ata|associated_token::authority|associated_token::mint" programs/
grep -rn --include="*.ts" -iE "getAssociatedTokenAddress|createAssociatedTokenAccount|getOrCreateAssociatedTokenAccount" apps/ packages/

Step 2: On-chain ATA accounts are constrained, not just typed

  • ✅ PASS: ATA accounts use Anchor associated_token::mint = …, associated_token::authority = … (+ correct associated_token::token_program), which enforces canonical derivation
  • ❌ FAIL: A plain Account<TokenAccount> with only token::authority/token::mint is accepted where the canonical ATA is assumed (any of the owner's token accounts passes)

Step 3: Correct token program in derivation

  • ✅ PASS: ATA derivation uses the matching token program (classic vs Token-2022) and the program asserts it
  • ❌ FAIL: Hardcoded classic Token Program ATA derivation while accepting Token-2022 mints (or vice versa) → wrong/derivable address

Step 4: Initialization & state assumptions

  • ✅ PASS: Program creates the ATA if needed (or requires it) and checks it is not frozen before relying on it
  • ❌ FAIL: Assumes ATA exists/unfrozen — transfer fails or funds route to an unintended account

Step 5: Off-chain consistency

  • For airdrops/refunds/credits computed off-chain by owner: confirm the destination is the canonical ATA, not "first found" token account
  • ✅ PASS: Off-chain resolves canonical ATA and on-chain re-asserts it
  • ❌ FAIL: Off-chain trusts a client-supplied token account

Overall verdict:

  • ✅: Canonical ATA enforced on-chain via associated_token::* with correct token program; state checked
  • ⚠️: Derivation correct but freeze/existence assumptions unchecked
  • ❌: Any owner-controlled token account accepted where the canonical ATA is assumed
  • N/A: Program does not use ATAs / does not credit per-owner accounts

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