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-vectors147-passive-role-token-account-unanchored.md

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

147 — Passive-Role Token Account Not Anchored to the Role

Severity: 9 when the payout can be triggered permissionlessly (crank, keeper, "anyone can disburse") and the role is passive: any caller redirects the role's funds. 7 when only the grant/vesting authority can trigger it (revoke, clawback): the trust model protects the role from that authority, but Rule 1's privilege lever applies; state the lever ("impact 9, needs the grant authority → 7"). 2 (hardening) when the role itself signs and picks the destination: the owner choosing where its own tokens go is not a program bug, and a malicious UI gains nothing it could not get with a follow-up transfer in the same transaction | Real: audit-finding class seen in rewards/vesting revoke and clawback handlers (qedgen benchmark corpus)

A missing runtime owner check asks whether the account is owned by the token program. This vector asks a different question: is the SPL account's recorded wallet (the owner field, bytes 32..64 of the 165-byte base layout) the role the parameter names, such as recipient, claimant or beneficiary? Any token account of the right mint passes owner == token program and token::mint = mint. KV-016 binds mints and source authorities. Payout destinations named after a passive role are the gap. An authority-signed revoke, clawback or disbursement can then send the role's tokens to any same-mint account the authority controls.

Cross-ref: AV-106, KV-016, FULL-AUDIT Step 1.5 P2.

Verification Procedure

Step 1: Role-named token accounts

rg -n -B8 'pub (recipient|claimant|beneficiary|destination|to)[a-z_]*_(token_account|ata|tokens?)\b' programs/
rg -n '(recipient|claimant|beneficiary|destination)[a-z_]*' programs/ | rg -i 'unpack|from_account_info|next_account_info'   # native

Anchor constraints sit in the #[account(..)] block above the field, hence -B8. Do not filter the output on token::authority: read each attribute block and confirm that the authority it names is the role and that the role is bound to stored state.

Step 2: Anchoring

  • ✅ PASS: token::authority = <role> / associated_token::authority = <role> / constraint = acct.owner == role.key() (native: unpack the token account and compare owner), with <role> itself bound to stored state (address = grant.recipient or has_one = recipient)
  • ❌ FAIL: only token::mint (and the token-program owner) is checked
  • ❌ FAIL: token::authority = recipient is present but recipient is itself unconstrained (any SystemAccount/UncheckedAccount the authority picks). That anchoring is circular and is not a pass.
// VULNERABLE: authority-signed revoke pays "recipient", but any same-mint account passes
#[account(mut, token::mint = mint)]
pub recipient_token_account: Account<'info, TokenAccount>,
pub recipient: SystemAccount<'info>,
pub authority: Signer<'info>,

// FIXED
#[account(has_one = authority)]
pub grant: Account<'info, Grant>,
#[account(mut, token::mint = mint, token::authority = recipient)]
pub recipient_token_account: Account<'info, TokenAccount>,
#[account(address = grant.recipient)]
pub recipient: SystemAccount<'info>,
pub authority: Signer<'info>,

Overall verdict:

  • ✅: every role-named destination is anchored to the role
  • ❌: a privileged path can pay a role's value to any same-mint account

Sources: qedgen/solana-skills skills/qedgen-auditor/references/category-catalog.md token_account_role_anchoring (MIT, Copyright (c) 2025 QEDGen). The corpus's advisory identifier and PR number could not be checked against a primary source, so they are omitted.

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