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-vectors171-timer-reset-third-party-or-zero.md

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

171 — Timer / Cooldown Reset by Third-Party or Zero-Amount Writes

Severity: 6 (5–6 when it blocks other users; 7 when reward timing can be gamed for profit) | Real: contest findings on lock/cooldown griefing (pattern)

An instruction that writes cooldown_start, lock_start, unlock_at, last_deposit_ts or last_claim_ts unconditionally can be called (a) by a third party on the victim's position — a dust top-up every period means the victim never unlocks — or (b) by the user with amount = 0 to reset a reward or JIT window in their favour. ECON-002/AC-044 cover cooldowns, not this griefing angle.

Cross-ref: ECON-095.

Verification Procedure
rg -n '(cooldown|unlock|lock_until|lock_start|last_deposit|last_claim)[a-z_]*\s*=\s*.*(unix_timestamp|slot|clock|Clock::get)' programs/

For each hit: must the position owner sign? Is amount > 0 (or a minimum) enforced?

  • ✅ PASS: only the owner can move the timer; or per-deposit lots; or third-party top-ups never move the timer and have a minimum size; zero-amount calls never refresh windows
  • ❌ FAIL: a non-owner or zero-amount call resets someone's timer
  • Note: a weighted unlock such as max(old_unlock, now + lock·amt/new_amount) is a design trade-off, not a fix — newly added funds unlock early (a top-up equal to the old balance near expiry is locked for only about half of lock).
// VULNERABLE
#[derive(Accounts)]
pub struct TopUp<'info> {
    #[account(mut)] pub payer: Signer<'info>,
    /// CHECK: any beneficiary
    pub owner: UncheckedAccount<'info>,
    #[account(mut, seeds = [b"stake", owner.key().as_ref()], bump)]
    pub stake: Account<'info, StakePos>,
}
// top_up(): s.amount += amt; s.lock_start = Clock::get()?.unix_timestamp;   // dust each period → never unlocks

// FIXED (one option)
require!(amt >= MIN_TOP_UP, StakeError::TooSmall);
if ctx.accounts.payer.key() == ctx.accounts.stake.owner {
    ctx.accounts.stake.lock_start = Clock::get()?.unix_timestamp;          // only the owner resets
}

Overall verdict:

  • ✅: nobody else can move a user's timer; zero-amount calls are inert
  • ❌: they can

Sources: sanbir/solana-auditor-skills solana-auditor/references/attack-vectors/attack-vectors-4.md V85 (MIT, Copyright (c) 2024 AI Skills Contributors); pashov/skills solidity-auditor/references/hacking-agents/invariant-agent.md timer-reset pattern (same copyright) with an added weighted-unlock caveat.

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