solana-vulnerability-scanner

Scans Solana and Anchor programs for six critical vulnerability patterns including arbitrary CPI and PDA validation flaws.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TECH-HY/SKILLS --skill solana-vulnerability-scanner-tech-hy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solana-vulnerability-scanner
Source: https://github.com/TECH-HY/SKILLS/tree/main/skills/solana-vulnerability-scanner
Command: npx skills add https://github.com/TECH-HY/SKILLS --skill solana-vulnerability-scanner-tech-hy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Solana programs have unique security pitfalls tied to their account model—arbitrary CPI calls, improper PDA validation, missing signer and ownership checks—that are easy to miss in manual review and can lead to drained funds or unauthorized access. This Skill systematically audits Solana and Anchor codebases for these platform-specific vulnerabilities. ## Core Features & Use Cases - Six Vulnerability Patterns: Detects arbitrary CPI, improper PDA validation, missing ownership checks, missing signer checks, sysvar spoofing, and improper instruction introspection. - Structured Audit Workflow: Guides a six-step scanning process covering CPI security, PDA validation, account validation, and instruction introspection with ripgrep search commands. - Severity-Ranked Reporting: Produces findings with file locations, vulnerable code snippets, attack scenarios, and secure remediation code for both native Rust and Anchor. - Use Case: Before launching a Solana protocol, run this Skill against your programs/ directory to catch a missing is_signer check on a withdraw function that would let any attacker drain the vault. ## Quick Start Audit the Solana programs in this repository for critical vulnerabilities and report findings with severity ratings and fixes.

Frequently Asked Questions about solana-vulnerability-scanner

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a Solana program for security vulnerabilities?

Scan the program for six critical patterns: arbitrary CPI, improper PDA validation, missing ownership checks, missing signer checks, sysvar spoofing, and improper instruction introspection. Use ripgrep to locate invoke() calls, find_program_address usage, and account deserialization, then verify each has proper validation.

What is an arbitrary CPI vulnerability in Solana?

Arbitrary CPI occurs when a program calls invoke() or invoke_signed() with a user-controlled program ID without validation. An attacker can substitute a malicious program that impersonates the intended one, such as a fake token program that steals funds during a transfer.

Does Anchor framework prevent Solana vulnerabilities automatically?

Anchor prevents many issues when used correctly: Program<'info, T> validates program IDs, Account<'info, T> checks ownership, Signer<'info> enforces signatures, and seeds constraints validate PDAs. However, using raw AccountInfo with CHECK comments bypasses these protections.

How do I validate a PDA correctly in Solana?

Use find_program_address() to derive the canonical bump rather than accepting a user-provided bump with create_program_address(). In Anchor, use the seeds and bump constraints, and store the canonical bump in the account for reuse in invoke_signed calls.

Why is the sysvar account check only a risk before Solana 1.8.1?

Before Solana 1.8.1, functions like load_instruction_at() did not verify the sysvar account address, letting attackers pass spoofed sysvar accounts with fake instruction data. Version 1.8.1 introduced checked variants like load_instruction_at_checked() that validate the sysvar automatically.

What are the limitations of static scanning for Solana vulnerabilities?

Static pattern matching cannot confirm exploitability, detect business logic flaws, or reason about cross-program state at runtime. Findings should be verified with unit tests, integration tests using malicious inputs, and a local solana-test-validator environment.