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-vectors023-token-2022-transfer-hook-attack.md

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

23 — Token-2022 Transfer Hook Attack

Severity: 7 | Real: Emerging attack surface (2024+), Token-2022 composability exploits

Malicious token with transfer hook executes arbitrary code during transfer — reentrancy vector and unexpected state changes.

Verification Procedure

Step 1: Check if protocol handles Token-2022 tokens

grep -rn --include="*.rs" -iE "token.2022\|token_2022\|spl_token_2022\|TokenExtension\|transfer_hook" programs/
  • If not handling Token-2022: N/A (but check step 2)
  • If handling Token-2022: proceed

Step 2: Check if arbitrary mints are accepted

grep -rn --include="*.rs" "remaining_accounts.*mint\|token_mint\|accepted_mint" programs/*/src/instructions/
  • If only whitelisted mints (SOL, USDC, etc.): lower risk
  • If any mint accepted: high risk — must handle transfer hooks

Step 3: Verify transfer hook awareness

grep -rn --include="*.rs" "transfer_hook\|get_transfer_hook\|execute_transfer_hook" programs/
  • ✅ PASS: Code explicitly handles or rejects tokens with transfer hooks
  • ❌ FAIL: No transfer hook handling — state changes during hook execution are uncontrolled

Step 4: Check state ordering around Token-2022 transfers

# If Token-2022 transfers are used, state must be saved BEFORE the transfer
# (because transfer hook could call back)
  • ✅ PASS: State saved before any Token-2022 transfer (checks-effects-interactions)
  • ❌ FAIL: State written after Token-2022 transfer (reentrancy via transfer hook)

Overall verdict:

  • ✅: Only whitelisted non-hook tokens, or explicit hook handling with state ordering
  • ⚠️: Accepts arbitrary tokens but hooks unlikely in practice
  • ❌: Accepts arbitrary Token-2022 tokens without hook handling
  • N/A: Only handles SPL Token classic (not Token-2022)

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