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-vectors154-anchor-program-executable-only.md

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

154 — Anchor Program That Checks Only executable

Severity: 8 | Real: GHSA-c6rc-8jpp-2fgc / CVE-2026-45137 (High, CVSS 8.2): Program<'info, System> accepted any executable on anchor-lang 1.0.0–1.0.1, fixed in 1.0.2

This vector has two shapes:

  1. Untyped Program<'info> (Program<'info, ()>, added in 1.0.0, #3878) checks only executable. It is meant for "whatever program the user wants to call" (routers, plugins), so it is an arbitrary-CPI surface by design.
  2. Program<'info, System> on 1.0.0–1.0.1. These versions treated T::id() == Pubkey::default() as "accept any executable". The System Program id is the all-zero key, so Program<System> behaved like shape 1. Exposure exists only where code builds an Instruction with program_id: ctx.accounts.system_program.key(), forwards the unchecked account to a third-party program that CPIs through it, or uses the type as proof of identity. Anchor's own system_program::{create_account, transfer, …} helpers and the generated init/realloc code pass system_program.key() into CpiContext, but the helpers build the instruction with system_instruction::*, which hard-codes the System id. They are therefore not redirected. system_instruction::* + invoke is safe for the same reason. <!-- verified: anchor v1.0.0/v1.0.1 lang/src/accounts/program.rs `is_unit_type = T::id() == Pubkey::default()`; v1.0.2 splits impl for Program<'a, ()>; v1.0.1 lang/src/system_program.rs create_account/transfer use system_instruction::*; v1.0.1 constraints.rs CpiContext::new(system_program.key(), ..) -->

Cross-ref: CPI-030, CPI-041, AN-002/AN-003, KV-009.

Verification Procedure

Step 1: Find the types and the version

rg -n "Program<'info *>|Program<'info, *\(\) *>" programs/
rg -n "Program<'info, *System>" programs/
rg -n -A1 '^name = "anchor-lang"' Cargo.lock
rg -n 'program_id:\s*\*?ctx\.accounts\.system_program\.(key|key\(\))|Instruction::new_with_[a-z]+\(\s*\*?ctx\.accounts\.system_program\.key' programs/

Step 2: Usage

  • ✅ PASS: untyped Program<'info> targets are allowlisted (address = or a pinned id in config) and never receive PDA signer seeds or forwarded user signers; on 1.0.0–1.0.1, no instruction takes its program id from the system_program account
  • ❌ FAIL: invoke_signed/with_signer to an untyped Program<'info>; or, on 1.0.0–1.0.1, a hand-built System instruction whose id comes from the account. PoC: pass the Compute Budget program in the system_program slot. That builtin's processor does nothing when invoked, so the "transfer" is a no-op and the program carries on as if it had been paid. <!-- verified: agave v4.3.2 programs/compute-budget/src/lib.rs process_instruction returns Ok(()) ("Do nothing") -->
// VULNERABLE (untyped program as an invoke target)
pub router: Program<'info>,                       // executable-only
invoke_signed(&Instruction { program_id: ctx.accounts.router.key(), accounts, data }, &infos, &[seeds])?;

// FIXED
#[account(address = JUPITER_V6_ID @ ErrorCode::BadProgram)]
pub router: Program<'info>,                       // or Program<'info, Jupiter> via declare_program!

Overall verdict:

  • ✅: no executable-only program account steers a CPI
  • ❌: one does, with signer privilege or value at stake

Sources: otter-sec/anchor GHSA-c6rc-8jpp-2fgc, lang/src/accounts/program.rs, lang/src/system_program.rs (Apache-2.0, Copyright 2020 Anchor Maintainers), exposure narrowed; solana-foundation/solana-dev-skill skills/solana-dev/references/anchor/migrating-v0.32-to-v1.md (generic Program<'info>) (MIT, Copyright (c) 2026).

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