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-vectors148-store-without-validate-persisted-trust.md

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

148 — Store-Without-Validate / Persisted Point-in-Time Trust

Severity: 7 (Critical when combined with a permissionless init that captures fees — KV-141. For the point-in-time owner variant, rate by who can register and what later trusts the key: 7–8 when registration is permissionless (or takes a caller-chosen address) and the recreated account later feeds a price, balance or authority decision by key alone; 3–5 when only an admin can register (the admin would have to register a zero-lamport, zero-data account; apply the privilege lever) or when the later use is informational) | Real: qedgen benchmark corpus (add_signer storing off-curve or default keys; init_config_field_unanchored)

The bug is in the write. The exploit is in a later handler that trusts the field.

  1. Store-without-validate. add_signer, add_member, set_authority, register and whitelist store a caller-supplied pubkey with no predicate. The key may be Pubkey::default(), not a signer, not the canonical PDA, a duplicate in a list, or off-curve where a wallet signature will be required later (the slot is bricked and the threshold becomes unreachable). A permissionless initialize that stores a caller-supplied fee_destination/creator_ata lets a front-runner capture every later fee.
  2. Point-in-time trust. acct.owner == X proves ownership now. Suppose an address is persisted as "a trusted X-owned account" after only an owner check. An attacker who holds a keypair can, inside one transaction, Assign that zero-lamport, zero-data address to X (System Assign needs only the keypair's signature) and call the victim while the owner reads X. Because the account holds no lamports it is purged when the transaction ends. Later the attacker recreates the same address and assigns it to a program they control. This matters only where later uses compare the key alone.

Cross-ref: AC-062, AV-107, KV-141, FULL-AUDIT Step 1.5 P3.

Verification Procedure

Step 1: Every persisted pubkey write

rg -n '\.(authority|admin|owner|fee_(destination|receiver|recipient)|treasury|creator[a-z_]*|oracle|signers?\[.*\]|members?\[.*\])\s*=\s*' programs/
rg -n '\.push\(\s*[a-z_]+\s*\)' programs/ | rg -i 'signer|member|admin|whitelist'
rg -n '=\s*ctx\.accounts\.[a-z_]+\.key\(\);' programs/

Step 2: Name the predicate that constrained each value before the write

  • ✅ PASS: the key is non-default; a signer or the canonical PDA where the role requires it; deduplicated; and on-curve when a wallet signature will be required. For the curve check use the curve25519 validation syscall (sol_curve_validate_point, wrapped as solana_curve25519::edwards::validate_edwards). Pubkey::is_on_curve() hits unimplemented!() on-chain (checked in solana-program 1.18 and solana-pubkey 2.1; confirm in the pinned crate for later versions). PDA members that sign through invoke_signed are legitimately off-curve. Init-config fields are bound to a Signer (token::authority = creator with creator: Signer) or derived canonically.
  • ❌ FAIL: no predicate
<!-- verified: agave v1.18.26 sdk/program/src/pubkey.rs and v2.1.21 sdk/pubkey/src/lib.rs (bytes_are_curve_point: #[cfg(target_os = "solana")] unimplemented!()); agave v2.1.21 curves/curve25519/src/edwards.rs (on-chain validate_edwards -> sol_curve_validate_point) -->

Step 3: Re-validation at use

  • ✅ PASS: persisted addresses are re-checked for owner + discriminator at every use (an Anchor Account<'info, T> / InterfaceAccount does this on load; UncheckedAccount / AccountInfo with address = stored_key does not)
  • ❌ FAIL: later handlers compare the key only
// VULNERABLE
multisig.signers.push(new_signer);             // new_signer: Pubkey argument

// FIXED
require!(new_signer != Pubkey::default(), ErrorCode::InvalidKey);
require!(!multisig.signers.contains(&new_signer), ErrorCode::DuplicateSigner);
// if the member must sign as a wallet, validate the point on-chain:
// require!(solana_curve25519::edwards::validate_edwards(
//     &solana_curve25519::edwards::PodEdwardsPoint(new_signer.to_bytes())), ErrorCode::OffCurveSigner);
multisig.signers.push(new_signer);

Overall verdict:

  • ✅: every persisted key has a predicate and is re-validated at use
  • ❌: any later privileged decision trusts an unvalidated or point-in-time-checked key

Sources: qedgen/solana-skills skills/qedgen-auditor/references/manual-review-passes.md §3e store-without-validate (MIT, Copyright (c) 2025 QEDGen) with the is_on_curve correction; solana-foundation/solana-dev-skill skills/solana-dev/references/security.md "Transient Account Owner Spoofing" (MIT, Copyright (c) 2026) with an added precondition.

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