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-vectors119-durable-nonce-pre-signed-governance-abuse.md

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

119 — Durable-Nonce Pre-Signed Governance Transaction Abuse

Severity: 9 | Real: Drift $285M (Apr 2026) — 2nd-largest Solana exploit

Normal Solana transactions expire when their recent blockhash ages out (~60–90s), which naturally time-bounds a signed transaction to the context in which it was authorized. A durable nonce (SystemInstruction::AdvanceNonceAccount as the first instruction, using a nonce account instead of a recent blockhash) removes that expiry — the signed transaction stays valid indefinitely until the nonce advances. When admin/governance actions are reachable via durable-nonce transactions, a transaction signed under one authorizing context (e.g. an old multisig configuration, before a migration or membership change) outlives that context and can be replayed later against the current state. In the Drift incident, pre-signed durable-nonce admin/governance transactions survived a multisig migration and, with no timelock to catch them, were executed afterward to drain the protocol.

This is an on-chain program-audit finding: any instruction that mutates admin/governance state, moves treasury funds, or changes authorities must not be executable from a pre-signed transaction that can survive the authorizing context.

Verification Procedure

Step 1: Find durable-nonce usage on admin/governance paths

grep -rn --include="*.rs" -iE "AdvanceNonceAccount|nonce_account|durable.?nonce|NonceAccount|recent_blockhashes" programs/*/src/
grep -rn -iE "AdvanceNonceAccount|nonceAccount|createNonceAccount|DurableNonce|advanceNonce" --include="*.ts" apps/ packages/ scripts/
  • Record whether admin/governance transactions are (or can be) built with a durable nonce rather than a recent blockhash

Step 2: Confirm admin/governance instructions cannot outlive their authorizing context

  • ✅ PASS: privileged instructions are documented/enforced to use a recent blockhash only (natural ~60–90s expiry), and/or a monotonic epoch/config_version on the authority account invalidates transactions signed under a prior configuration (a migration bumps the version so stale pre-signed txs revert)
  • ❌ FAIL: an admin/governance/treasury instruction can be executed from a durable-nonce (pre-signed) transaction with no version/epoch guard — it survives a multisig migration or membership change and can be replayed

Step 3: Verify a timelock gates privileged actions

grep -rn --include="*.rs" -iE "timelock|delay|eta|not_before|execute_after|unlock_ts|queued_at" programs/*/src/
  • ✅ PASS: privileged actions are queued behind an on-chain timelock, so a surfaced pre-signed/stale transaction is visible and cancellable before it can execute
  • ❌ FAIL: privileged actions execute instantly — a replayed durable-nonce tx takes effect with no window to react

Step 4: Verify an aggregate-outflow circuit breaker exists

grep -rn --include="*.rs" -iE "circuit.?breaker|max.*outflow|rate.?limit|withdraw.*cap|daily.*limit|paused|guardian" programs/*/src/
  • ✅ PASS: an aggregate-outflow / rate-limit circuit breaker caps how much value any admin path (including a replayed one) can move per window, and a guardian can pause
  • ❌ FAIL: no outflow cap — a single replayed governance transaction can drain the protocol

Step 5: Nonce-authority custody

  • ✅ PASS: the nonce authority of every nonce account used for privileged pre-signed transactions is held with quorum ≥ the transaction's quorum
  • ❌ FAIL: a single or external nonce authority — honest signers cannot revoke an outstanding approval (anyone holding the signed bytes can submit it until the nonce advances; only the nonce authority can advance it)
  • Review signals (not proof): timelock removal/shortening; threshold reduction or signer rotation bundled with other admin changes; emergency-authority migration before a high-impact action; signer churn; pre-signed admin txs accepted without fresh confirmation (OPS-092)
  • False-positive guard: durable nonces alone are not a finding.

Sources: beriktassuly/solana-audit-skill skill/references/taxonomy/durable-nonce-governance.md (MIT, Copyright (c) 2026 Berektassuly).

Overall verdict:

  • ✅: Admin/governance instructions are recent-blockhash-only (or version/epoch-guarded), gated by a timelock, and bounded by an aggregate-outflow circuit breaker
  • ⚠️: Recent-blockhash-only or version-guarded, but no timelock or no outflow cap
  • ❌: Privileged actions reachable via durable-nonce pre-signed transactions that outlive the authorizing context, with no timelock and no circuit breaker
  • N/A: Program has no admin/governance/treasury-mutating instructions

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