Works with the AI Agents you already use

    Solana Program Security Audit

    by BanditXBT

    1

    Account-validation-first security audit method for native and Anchor Solana programs.

    $4.20

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    About this skill

    Solana programs receive every account from the caller. The core question for each instruction: could an attacker pass a different account than I assume? Most critical bugs are missing validation, not clever math.

    1. Scope & invariants. List instructions, account types, authorities, and 5-10 invariants (e.g., "vault token balance ≥ Σ user deposits", "only admin can change config", "a position cannot be opened under initial margin").
    2. Per-instruction account table. For each account: writable? signer? expected owner program? expected address/PDA seeds? expected type/discriminator? relationship to other accounts (has_one-style)? Anything not pinned down is a finding candidate.
    3. Manual pass by bug class (below), then write a failing test per suspected bug (see solana-testing-fuzzing).
    4. Report with exploit transaction sketch (which fake accounts, in what order), impact, and fix.
    • Missing signer check: authority accounts must be Signer (Anchor) or is_signer verified. A pubkey match alone is not authorization.
    • Missing owner check: deserialized data from an account not owned by the expected program can be forged. Check account.owner == expected_program_id (Anchor Account<T> does this; UncheckedAccount/AccountInfo does not).
    • Type cosplay / discriminator: two account types with the same layout can be substituted. Require 8-byte (Anchor) or custom discriminators checked on deserialize.
    • PDA validation: derive and compare against the passed address; use the canonical bump (from find_program_address), store it, and never accept user-supplied bumps. Seeds must be collision-free (include type prefix, separators/fixed-length fields; avoid concatenating two variable-length seeds).
    • Arbitrary CPI: verify the callee program ID before invoke/invoke_signed (e.g., token program, your own program). Passing an attacker program lets it receive your signer privileges. Beware CPI depth limit (4) and that invoke_signed extends PDA signer authority to the callee.
    • Account relationship/substitution: token account's mint/owner match the expected mint/authority; vault belongs to this pool; oracle account matches the market's stored feed (Cashio, Mar 2022: unvalidated collateral account chain let attacker mint with worthless collateral).
    • Duplicate mutable accounts: the same account passed twice under different names can bypass invariants (e.g., source == destination). Add explicit inequality constraints.
    • remaining_accounts: unchecked by Anchor's constraints; validate every element manually.
    • Reinitialization / init-if-needed: an already-initialized account re-initialized resets state or steals authority; init_if_needed needs explicit guards. Pre-funded or pre-created PDAs can DoS init (griefing): handle accounts that already hold lamports.
    • Closing accounts: zero data, transfer all lamports, and reassign to the system program (Anchor close = does this). In-tx "revival": after close, an account can be refunded within the same tx and reused if the discriminator isn't invalidated.
    • Arithmetic: release builds do not check overflow unless overflow-checks = true in [profile.release]; use checked_*/saturating_* deliberately, avoid unsafe as casts (truncation), watch rounding direction (round against the user), and precision loss with mixed decimals.
    • Sysvar spoofing: read sysvars via Clock::get() etc. If an instruction takes a sysvar account, verify its address. Wormhole's Feb 2022 loss stemmed from an unchecked instructions-sysvar account (load_instruction_at vs. load_instruction_at_checked).
    • Stale data after CPI: account data changes during CPI are not auto-reflected in already-deserialized structs; call reload() (Anchor) before reading.
    • Realloc & rent: rent-exempt minimum maintained after realloc; max growth per instruction is 10 KiB; zero-init new bytes.
    • CPI return data & introspection: get_return_data returns (program_id, data): verify the program ID matches the callee you invoked, since any program in the call stack can set return data. Treat instruction-sysvar introspection (e.g., verifying a sibling signature instruction) as security-critical: check program ID, index, and that the verified message matches what you act on.
    • PDA signer scope: a PDA's invoke_signed authority is usable by any code path in your program that knows the seeds; ensure no instruction lets a caller choose seeds/accounts that make your PDA sign for an unintended action (e.g., authority PDA shared across all pools).
    • Authority & state hygiene: two-step authority handover, no Pubkey::default() authorities, no writable config accounts without owner and PDA checks, and explicit handling of closed/uninitialized accounts passed as inputs.
    • Token handling: token program ID checks, Token-2022 extensions (see spl-token-2022-security), freeze/mint authority assumptions, decimals.
    • Upgrade authority & admin keys: who can change the program or config, and can they steal funds? (see solana-deploy-upgrade-ops).
    • Oracles: see solana-oracle-risk-review.
    • Economic/MEV: sandwiching via Jito-style bundles, front-running initialization, slippage/deadline checks, liquidation races.
    • DoS: unbounded Vec growth, compute exhaustion in loops, account-lock contention on one hot account.

    [SEV] Title — file:line · Fake-account exploit sequence · Impact (funds at risk) · PoC test · Fix. End with invariants verified, tools run (cargo clippy, cargo audit, cargo geiger/review of unsafe, anchor build warnings), and areas not reviewed. Never claim "no bugs"; state coverage.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 13 days ago

    Software
    Rust
    Optional
    Solana CLIAnchor

    Permissions

    No special permissions declared or detected

    Listed13 days ago

    What's inside

    Frequently Asked Questions

    Account-validation-first security audit method for native and Anchor Solana programs.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use solana-program-security-audit on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Security

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.