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.

referencesmethodologiesdimensional-analysis.md

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

Dimensional (unit) analysis for Solana value paths — manual method

Use when the ToB dimensional-analysis plugin is unavailable (boundary-map fallback) and on every value-moving path in checklists 03/06.

Notation. [scale]{unit}: {lamport}, D(mint.decimals){tok:USDC}, {price:SOL/USD}·10^expo, {bps}, {ppm}, Q64.64{sqrtP}, {slot}, {s}, {share}, {1}.

Quantity Dimension Common trap
SOL balance {lamport} (1e9 per SOL) mixing lamports with wSOL token amount while the rent reserve sits in the account (KV-163)
SPL amount D(decimals){tok:MINT} decimals from the wrong mint; adding two mints; Token-2022 gross amount vs net received
Pyth price {quote/base}·10^expo, expo an i32 — usually negative, handle positive ignoring expo; mixing conf at another scale; comparing to Switchboard at a different scale
Switchboard decimal mantissa + scale assuming Pyth's scale
Fees {bps} (1e4) vs {ppm} (1e6) vs D9/D18 rates a bps constant applied to a ppm field
CLMM Q64.64{sqrt(tokB/tokA)}, {tick} squaring without u128/U256 widening; A/B orientation swapped
Time {slot} vs {s} (Clock.unix_timestamp, i64) slot deltas used as seconds (KV-138)
Vault {share} vs {tok}; rate {tok/share} returning shares on one branch and tokens on another

Algebra. +, − and comparisons need the same unit and scale. × adds scales, ÷ subtracts them — a rescale must follow. A {1} constant must be justified.

Bug patterns. decimals where an amount is expected (or the reverse); cross-mint addition; oracle expo ignored or applied in the wrong direction; missing or redundant rescale after price × amount; return paths with different dimensions; a fee on the wrong quantity (shares vs tokens; gross vs net); slot/second confusion; hidden dimension inside a helper (to_ui_amount() returning a float, normalize() assuming 6 decimals).

Procedure. (1) Annotate every state field and handler argument with a unit comment. (2) Propagate units through every expression on value-moving paths. (3) Every cross-unit add/subtract/compare is a candidate; every multiply/divide must be followed by an explicit rescale. (4) Record each candidate under AR-078.

rg -n '\bdecimals\b|10u(64|128)\.(checked_)?pow|\.expo\b|exponent|_bps\b|BPS|PPM|PRECISION|SCALE|Q64|<<\s*64' programs/
rg -n 'unix_timestamp|\.slot\b' programs/

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