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-vectorsINDEX.md

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

Known Attack Vectors — Index

One line per vector. Click to see the full multi-step verification procedure.

Scope: Solana on-chain programs (Anchor / native solana-program / Pinocchio) plus the operational vectors that directly threaten a deployed program (key custody, upgrade authority, vendored program provenance). Off-chain web / backend / frontend / AI-agent / CI vectors are out of scope for this skill. Vector numbers are stable identifiers, so gaps in the numbering are intentional — never renumber or reuse a gap.

Load-when (markers) column — advisory gating

Every row carries a Load when (markers) cell: the grep/prescan markers that make the vector worth loading for a given codebase. This is a token-efficiency layer, not a scope gate — the completeness guarantee (OUTPUT-RULES Rule 0: every in-scope vector gets a verdict) is unchanged.

  • Feature markers (e.g. pyth·switchboard, token_2022·transfer_hook, invoke·CpiContext) mean the vector is feature-specific. When every marker is provably absent — an empty prescan array (see references/orchestration/pre-scan.md) or zero grep hits across the in-scope tree — the vector is skip-deferred and renders [N/A — feature absent: <marker>]. This is an evidence-backed verdict, and it reopens on demand: the instant a manual read surfaces the feature, load the vector and evaluate it.
  • always (<phase>) means the vector is universally applicable within that phase/domain and is NEVER skipped (private-key leak, secrets, supply-chain, access control, and other baseline vectors). A marker cell must never make a vector unreachable — when in doubt a vector is tagged to its phase (always-load for that scope), not a narrow feature.
  • Quick audit. A quick audit evaluates only the rows with Severity 7 or higher whose trigger fires (an always (crypto) cell, or at least one marker present in the in-scope tree), lists which ones it evaluated, and says that the others were not evaluated (QUICK-AUDIT.md §1 step 5). "NEVER skipped" and "every in-scope vector gets a verdict" are the completeness rules of full, targeted and differential audits. The Severity column is the class's ceiling when its impact is realised, not the score of a finding (OUTPUT-RULES Rule 1).

How to Contribute

  1. Create a new file: NNN-short-name.md using the next number above 182 (numbers up to 182 are reserved, including the gaps; never reuse one)
  2. Follow the existing format: YAML frontmatter + ### N — Title + severity + real-world example + verification procedure with numbered steps
  3. Add your entry to this index under the matching section (include the Load when (markers) cell — default to always (<phase>) unless the vector is provably feature-specific)
  4. Update the totals at the bottom of this file, then submit a PR

Crypto / On-Chain (1-30)

# Vector Severity Load when (markers)
1 Private Key Leak 10 always (crypto)
2 Flash Loan Price Manipulation 10 flash · flashloan · oracle-priced deposit/withdraw · pyth · switchboard
3 Reentrancy (CPI) 10 invoke · invoke_signed · CpiContext
4 Missing Access Control 10 always (crypto)
5 Oracle Manipulation 9 pyth · switchboard · oracle · PriceUpdate · get_price
6 First Depositor / Share Inflation 9 shares · mint_to · deposit · vault · total_supply
7 MEV Sandwich Attack 7 swap · slippage · min_amount_out · route
8 Rug Pull / Admin Backdoor 10 always (crypto)
9 Unchecked CPI Target 9 invoke · invoke_signed · CpiContext · program_id
10 PDA Confusion / Type Cosplay 8 seeds · find_program_address · AccountInfo · try_deserialize
11 Integer Overflow / Underflow 9 arithmetic_sites · + - * / · checked_
12 Arithmetic Rounding Exploit 7 arithmetic_sites · / · div · mul_div · shares
13 Missing Signer Check 10 always (crypto)
14 Account Reinitialization 8 init · init_if_needed · is_initialized
15 Unchecked Account Owner 9 always (crypto)
16 Token Account Mismatch 8 TokenAccount · token::mint · token::authority · spl_token
17 Vault Donation Attack 7 vault · get_token_account_balance · .amount · shares
18 Fee-on-Transfer Token Exploit 7 token_2022 · TransferFee · transfer_hook · get_extension
19 Freeze Authority Griefing 6 freeze_authority · FreezeAccount · mint
20 Program Upgrade Hijack 10 always (crypto)
21 Governance Attack (Vote Buying) 8 realm · proposal · spl-governance · vote_record · voter_weight
22 Bridge Exploit (Fake Proof) 10 guardian · vaa · emitter · verify_signatures · attestation
23 Token-2022 Transfer Hook Attack 7 token_2022 · transfer_hook · TransferHook · get_extension
24 Stale/Missing Account Close 5 close · lamports · realloc
25 Compute Budget Exhaustion DoS 6 loops · remaining_accounts · Vec · panic_sites
26 PDA Seed Collision 8 seeds · find_program_address · create_program_address
27 Missing Discriminator Check 8 try_deserialize · AccountInfo · remaining_accounts · discriminator
28 Front-Running Transaction 6 swap · claim · commit · slippage · price-sensitive ix
29 Withdraw-Before-Update Race 8 withdraw · invoke · state-mutation-after-CPI · reload
30 Infinite Mint / Uncapped Supply 10 mint_to · supply · mint_authority · max_supply

Program Deployment Ops (91)

# Vector Severity Load when (markers)
91 Upgrade Authority Not Secured 10 always (devops)

On-Chain — Modern Surface (101-109)

Added in v4.4. Focus: sysvars, precompiles, lookup tables, PDA bump canonicalization, Token-2022 extensions, account revival, ATA assumptions, token decimals, and native/Pinocchio (p-token) programs.

# Vector Severity Load when (markers)
101 Sysvar Spoofing & Instructions-Sysvar Introspection 8 sysvar · instructions_sysvar · load_instruction_at · get_instruction_relative
102 Precompile Signature Verification Bypass (Ed25519/Secp256k1) 9 ed25519 · secp256k1 · precompile · instructions_sysvar · signature-verify ix
103 Address Lookup Table (ALT) Manipulation 7 address_lookup_table · AddressLookupTable · lookup_table · versioned tx
104 Non-Canonical Bump / PDA Derivation Confusion 7 seeds · bump · create_program_address · find_program_address
105 Token-2022 Extension Abuse (permanent delegate / frozen-default / fee / confidential / mint-close) 8 token_2022 · get_extension · PermanentDelegate · ConfidentialTransfer · TransferFee
106 Account Revival / Zombie After Close 8 close · lamports · realloc · is_initialized · reopen
107 Fake / Non-Canonical Associated Token Account (ATA) 8 associated_token · get_associated_token_address · ATA · token::authority
108 Token Decimals & Cross-Mint Amount Confusion 7 decimals · amount · multi-mint · transfer_checked · mint.decimals
109 Pinocchio / p-token — Missing Manual Validation in Zero-Copy Native Programs 8 pinocchio · p-token · no_std · AccountInfo · manual-validation (native, no Anchor)

On-Chain DoS — SBF Stack Limits (111)

# Vector Severity Load when (markers)
111 BPF Stack Frame Overflow DoS 6 large stack arrays · [u8; N] · deep recursion · panic_sites (on-chain)

On-Chain — Governance & Randomness (118-120)

# Vector Severity Load when (markers)
118 Stake Account Authority Hijack 8 stake · StakeProgram · authorized · staker · withdrawer
119 Durable-Nonce Pre-Signed Governance Abuse 9 nonce · durable_nonce · advance_nonce · realm · proposal · governance
120 On-Chain Randomness Predictability & VRF Misbinding 7 random · vrf · switchboard · Clock · slot_hashes · blockhash

Modern On-Chain, Custody & Off-Chain Consumers (121-123, 125-126)

# Vector Severity Load when (markers)
121 cNFT / Account-Compression Merkle Proof Abuse 7 spl-account-compression · bubblegum · merkle · cNFT · proof
122 Inner-Instruction / Event-Log Spoofing 7 emit_cpi · invoke · inner-instruction · event parsing off-chain · sol_log
123 Lamport-Donation Account Bricking (King-of-the-SOL) 6 lamports · rent-exempt check · try_borrow_lamports · balance-equality assumption
125 Bonding-Curve Launchpad Graduation & Migration Abuse 7 bonding_curve · graduate · virtual_reserves · migrate · curve
126 Session Token as Custody 7 session · session_token · delegated-signing · spending_limit

DoS, Float Math, Keeper Lifecycle & CLMM Math (127-131)

# Vector Severity Load when (markers)
127 ATA / Account Pre-Creation DoS (Init Front-Running) 6 init · create_associated_token_account · init_if_needed · pre-creation
128 On-Chain Floating-Point Financial Math 5 f32 · f64 · as f64 · .sqrt() · .powi( · float in value math
129 Keeper Request→Execute Front-Running & Reordering 7 keeper · request · execute · two-step · crank · settlement
130 CLMM/DLMM Tick-Boundary & Liquidity Math 7 tick · sqrt_price · liquidity_net · bin_array · fee_growth
131 Write-Lock Account Contention DoS (Hot Shared Writable) 6 shared writable account · global mut state · single hot PDA · #[account(mut)] global

Permissioned Tokens (134)

# Vector Severity Load when (markers)
134 Token ACL (SRFC-37) Gate-Program Bypass & Permissionless-Freeze Griefing 7 token_acl · TACLkU6 · MINT_CFG · gating_program · thaw_permissionless · can_thaw_permissionless · DefaultAccountState + delegated freeze authority

Transaction Format & Runtime-Upgrade Readiness (135)

# Vector Severity Load when (markers)
135 Transaction v1 Fee-Sponsor Cap Bypass & Disabled ComputeBudget Gates 8 feePayer / fee_payer as a service · sponsor · paymaster · gasless · relayer · partialSign · ComputeBudgetProgram scan · load_instruction_at + compute_budget

Vendored Programs & White-Label Fleets (137)

# Vector Severity Load when (markers)
137 White-Label / Vendored On-Chain Program Version Drift & Inherited Admin Surface 8 always (crypto)

Runtime Timing: 200 ms Slots & the Alpenglow Clock (138)

# Vector Severity Load when (markers)
138 Slot-Denominated Time After SIMD-0525 (Slot Used as a Clock) 7 clock.slot · Clock::get()?.slot · SLOTS_PER_YEAR · DEFAULT_TICKS_PER_SLOT · DEFAULT_MS_PER_SLOT · *_slot duration / deadline fields · epoch-denominated lockups · warp_to_slot · 216_000 / 432_000

Crypto / On-Chain (141-182)

Added in v8.0. Focus: initialization and authority-anchoring gaps, instruction introspection and return data, Anchor version-dependent semantics, native/Pinocchio type cosplay and unsafe code, SPL / Token-2022 account lifecycle, and protocol-logic invariants (sibling-path guards, timers, snapshots, payout bounds, atomic outcomes).

# Vector Severity Load when (markers)
141 Unbound Singleton Initialize Front-Run 6 always (crypto)
142 Pre-Allocated Account Init Hijack / Re-Initialization 8 zero · load_init · AccountLoader · is_initialized · UncheckedAccount written in initialize*
143 PDA Signer Sharing / Cross-Instance Vault Drain 9 invoke_signed · with_signer · new_with_signer · token::authority
144 Self-Referential Seeds & Permissionless Gating Objects 8 seeds
145 Tautological Constraints Anchored on Unchecked Keys 8 seeds::program · owner = · UncheckedAccount · AccountInfo<
146 Parent-Substitution Authority Bypass (Root-Anchor Chain) 9 always (crypto)
147 Passive-Role Token Account Not Anchored to the Role 9 TokenAccount · token_account · recipient · beneficiary · claimant
148 Store-Without-Validate / Persisted Point-in-Time Trust 7 always (crypto)
149 Internal-Only Instruction Reachable as a Public Entrypoint 9 invoke_signed · with_signer · self-CPI · crate::ID
150 Discarded Result, Built-but-Not-Invoked Instruction, Default-on-Error 7 let _ = · .ok() · unwrap_or_default · instruction::
151 Instruction-Introspection Pairing Bypass (Flash-Loan Repay, Many-to-One, CPI-Wrap) 9 load_instruction_at · load_current_index · get_instruction_relative · sysvar::instructions · flash
152 CPI Return-Data Spoofing 7 get_return_data · set_return_data · Return<
153 Anchor Legacy IDL Instruction Surface 5 anchor-lang · legacy_idl · no-idl
154 Anchor Program That Checks Only executable 8 Program<'info> · Program<'info, System> · anchor-lang = "1.0.
155 Anchor Constraint Codegen Identifier Shadowing 8 has_one · owner = · address = · fields my_key/my_owner/actual
156 Anchor Discriminator Collisions (Generic, Custom, Short, All-Zero) 8 discriminator = · generic #[account] structs
157 Anchor Optional-Account Gate Bypass 8 Option<Account · Option<Signer · Option<UncheckedAccount
158 Anchor Framework-Version Security-Fix Exposure 7 anchor-lang
159 Native Borsh Enum / Hand-Rolled Tag Type Cosplay 8 try_from_slice · BorshDeserialize · entrypoint! · pinocchio
160 Upgrade Layout Drift / Unmigrated Accounts 8 always (crypto)
161 Vault Return-to-Zero Residual Capture 7 shares · total_shares · vault · mint_to
162 Unbacked Pre-Funded Reserve at Initialization 8 initialize · reserve · vault · total_lamports
163 Wrapped-SOL SyncNative Balance Manipulation 7 NATIVE_MINT · native_mint · So11111111111111111111111111111111111111112 · sync_native · is_native
164 Adopted Token Account: Surviving Close Authority, Close and Re-Create 7 token::authority · set_authority · TokenAccount
165 Residual SPL Delegate Approval on a Program-Owned Token Account 7 approve · approve_checked · delegate
166 Token-2022 Mint Resurrection: Orphan Accounts with a Stale Extension Set 7 token_2022 · MintCloseAuthority · NonTransferable · TransferHook · TransferFee · Pausable
167 Transfer-Hook Execute Unauthenticated (Hook Program Author Side) 8 spl_transfer_hook_interface · TransferHookInstruction · ExtraAccountMetaList · execute
168 Token Close-Path DoS: Dust, Withheld Fees, Confidential Balances 5 close_account · CloseAccount · close = on token accounts
169 Push-Payout Bricking by Recipient-Controlled Account State 6 remaining_accounts loops with transfer · distribute · settle · payout
170 Sibling-Path Guard Asymmetry (Cap, Fee, Pause, Accounting Bypass) 7 always (crypto)
171 Timer / Cooldown Reset by Third-Party or Zero-Amount Writes 6 cooldown · lock_start · unlock · last_deposit · last_claim
172 Live Config Read at Execute / Release Instead of a Snapshot 6 request · ticket · pending · config. read in execute/claim/withdraw
173 Accrual Keeps Running While Paused 6 paused · accrue · last_accrual · last_update_ts
174 Config Update Silently Drops a Field 5 fn update_ · fn set_ · Params · Settings
175 Parent Close with Live Children: Orphaned or Revived Child PDAs 7 close = on a parent type with children seeded by its key
176 Payout Schedule Exceeds Recorded Principal 8 vest · unlock · claimable · releasable · interval · period
177 Declared Intent the Code Never Enforces 5 always (crypto)
178 Atomic Outcome Revert (Same-Transaction Settlement) 8 random · roll · spin · lottery · raffle · loot · winner
179 On-Chain Secrets & Low-Entropy Commitments 7 pin · secret · password · passcode · hash( of small values
180 On-Chain Memory Corruption Escalating to Signed CPI 9 unsafe · transmute · from_raw_parts · get_unchecked · fn( pointers
181 sBPF v3 / Gap-less Stack: Faults That Used to Protect Become Silent 7 unsafe · read_unaligned · ptr::read · copy_nonoverlapping
182 Pinocchio / Unsafe-Protocol Hazards Around Unchecked Borrows and CPIs 8 pinocchio · _unchecked( · SAFETY: · invoke_signed_unchecked

Known Duplicates & Consolidation Map

The kept set contains one near-duplicate pair (same root cause catalogued under two categories). Both files are retained so the "Crypto" and "Program Deployment Ops" reading paths stay complete, but an auditor should evaluate the pair once and cross-reference the verdict — do not double-count it as independent coverage. Severity is aligned to the higher of the pair.

Canonical Duplicate of Topic Aligned Severity
020 091 Program upgrade authority compromise 10

Every other overlap (e.g. 023 ↔ 105 Token-2022 hooks/extensions, 014 ↔ 106 reinitialization vs revival, 010 / 026 / 104 PDA derivation, 014 ↔ 127 ↔ 141 ↔ 142 initialization, 026 ↔ 143 ↔ 144 PDA signer and seed scope, 101 ↔ 151 instruction introspection, 010 / 027 ↔ 156 / 159 discriminators and type cosplay, 105 ↔ 166 and 023 ↔ 167 Token-2022 extensions/hooks, 016 ↔ 147 / 164 token-account binding, 024 / 106 ↔ 175 close paths, 109 ↔ 182 and 180 ↔ 181 Pinocchio / unsafe memory) is a distinct concept: each gets its own verdict, with the shared root cause cited in the cross-ref notes inside the vector files.

Distinct concepts: 99 (100 files − 1 duplicate pair).


Total vector files: 100 (58 on-chain and program-ops vectors kept from the upstream catalog, numbering preserved, + 42 in v8.0: 141-182) Distinct concepts: 99 (after consolidating 1 duplicate pair) Categories (frontmatter category): 4 (crypto, devops, dos, backend — the two backend vectors, 126 and 135, are kept for their on-chain custody / fee-payer surface) Severity range: 5-10

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