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-vectors176-payout-exceeds-principal.md

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

176 — Payout Schedule Exceeds Recorded Principal

Severity: 8 (HIGH → CRITICAL with a shared vault and permissionless claim) | Real: Ackee Solana Auditors Bootcamp CTF level-4 vesting; qedgen benchmark corpus

Vesting, streaming, reward and interest payouts must never sum past the deposit. A formula wrong at the boundary passes every checked_* operation and still over-pays, so unchecked-arithmetic greps do not find it; with a shared vault the excess comes out of other depositors' principal ("the vault balance caps it" only means the last claimant absorbs the shortfall). Classic shape, defect from qedgen/solana-skills skills/qedgen-auditor/references/category-catalog.md payout_exceeds_recorded_principal [verbatim, MIT, (c) 2025 QEDGen]:

// periods counts the *current* period as already released
let periods = elapsed.checked_div(period_len)?.checked_add(1)?;
periods.checked_mul(per_period)?.checked_sub(already_paid)

The +1 unlocks one full interval at t = start and runs one interval ahead of the linear curve. At t = end (or later, with elapsed clamped to D) it yields floor(D/i) + 1 intervals. Without the clamp it keeps growing after end. So it over-pays whether or not D divides evenly. With per_period = A·i/D: A=1000, D=10, i=5 → 1500; i=3 → 1200. Also check start/end caller-supplied u64 vs i64 clock casts.

Cross-ref: ECON-110, references/methodologies/vesting-streaming.md, invariant-catalog §11.

Verification Procedure
rg -n -i 'fn (claimable|releasable|vested|accrued|pending|unlocked)[a-z0-9_]*' programs/
rg -n 'checked_add\(1\)|/\s*[a-z_.]*interval\s*\+\s*1' programs/
rg -n '\.min\([a-z_.]*(amount|total|principal)' programs/      # absence near the payout fn is the smell

Evaluate each schedule at now == start, now ≥ end and the last period.

  • ✅ PASS: payout clamped min(computed, principal − already_paid) before transfer; exact at end; property test (unlocked(t) ≤ A, monotone, unlocked(start) == 0 unless a documented cliff/tranche, unlocked(end) == A)
  • ❌ FAIL: any schedule can exceed principal
// FIXED
pub fn vested(total: u64, start: i64, end: i64, cliff: i64, now: i64) -> Option<u64> {
    if now < cliff.max(start) { return Some(0); }
    if now >= end { return Some(total); }                         // exact at end
    let elapsed = u128::try_from(now.checked_sub(start)?).ok()?;
    let dur = u128::try_from(end.checked_sub(start)?).ok()?;      // validated end > start at creation
    u64::try_from((total as u128).checked_mul(elapsed)?.checked_div(dur)?).ok()   // floor ≤ total
}
// claim: let claimable = vested(..)?.checked_sub(escrow.withdrawn)?;  assert withdrawn + claimable ≤ total

Overall verdict: ✅ Σ payouts ≤ principal at every t · ❌ boundary over-payment

Sources: Ackee-Blockchain Solana-Auditors-Bootcamp Capture-the-Flag/level-4 vesting [paraphrased, cited: https://github.com/Ackee-Blockchain/Solana-Auditors-Bootcamp/tree/master/Capture-the-Flag/level-4] with a corrected over-unlock condition; qedgen/solana-skills skills/qedgen-auditor/references/category-catalog.md payout_exceeds_recorded_principal (MIT, Copyright (c) 2025 QEDGen) — defect shape verbatim.

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