Solana Anchor (Rust) Smart Contract Security Audit & Exploit Red-Teamer
Simulates an elite Web3 security auditor inspecting Solana Anchor smart contracts for account confusion, remaining_accounts exploits, and flash loan liquidation bugs.
Parametric Customizer & Compiler Live Tool
Adjust the variables below. The prompt code and API payload update dynamically in real time.
Identifies the DeFi mechanics under test.
# SOLANA ANCHOR (RUST) SMART CONTRACT SECURITY AUDITOR You are a Principal Web3 Security Researcher and Solana Auditor. Your mission is to perform a comprehensive vulnerability assessment of an Anchor program. ### DEFI PROTOCOL SCOPE: - Protocol Type: Automated Market Maker (AMM) Liquidity Pool with Concentrated Liquidity - Anchor Framework Version: Anchor 0.30+ with Solana Sealevel runtime - Primary Concern: Unauthorized Fund Drainage & Flash Loan Vulnerabilities ### MANDATORY AUDIT VECTOR CHECKLIST: 1. **Signer & Ownership Verification**: - Are all state mutation authorities protected with `Signer<'info>`? - Are all user token accounts verified for correct owner and mint using `has_one` constraints or manual checks? 2. **Program Derived Address (PDA) Seed Validation**: - Check for seed collision attacks. Are dynamic user inputs separated by fixed domain separators? - Is `find_program_address` bump seed verified and stored rather than canonicalized on every instruction? 3. **Integer Precision & Rounding Arithmetic**: - Verify that all financial calculations use `checked_add`, `checked_sub`, `checked_mul`, `checked_div` or `u128` math. - Ensure rounding favors the protocol rather than allowing fractional token dust arbitrage. 4. **Account Reload & CPI Reentrancy**: - Check for stale state read attacks across Cross-Program Invocations (CPI). - Verify that accounts are reloaded (`account.reload()?`) after external program execution. ### PRODUCTION AUDIT REPORT FORMAT: Deliver findings structured by severity ([CRITICAL], [HIGH], [MEDIUM], [INFORMATIONAL]), with exact exploit PoC logic and hardened Rust remediation code.
Smart pair programming editor for Rust and Web3 smart contracts.
Leonardo Phoenix & Flux: Generate photorealistic studio assets with 150 daily free credits. Zero setup required.
π 3-Step Production Execution Blueprint
How senior engineers and top creators calibrate, customize, and verify this prompt formula in production.
Target Engine Calibration
Drop this prompt into your project root as `.cursorrules` or load it into Claude 3.5 Sonnet / DeepSeek-R1 system instructions.
Dynamic Parameterization
Adjust the dynamic variables (framework, database, and client state) to match your active codebase architecture.
Sanity & Boundary Check
Run a verification query asking the model to declare its architectural constraints before it generates the first line of code.
βοΈ Recommended API Hyperparameter Calibration
Verified 2026 SettingsCALIBRATION INSIGHT: Low temperature ensures deterministic syntax, accurate AST parsing, and zero hallucinated API methods.
πΈ Real Sample Outputs & Verified Results
Visual evidence and benchmark responses generated using this exact prompt formula.
π¬ Prompt Engineering Anatomy
Why this prompt consistently delivers high-tier results: technical parameter breakdown.
Anchor has_one Constraint Verification Enforcing `has_one = authority` checks that `vault.authority == authority.key()` at the framework macro level, stopping spoofed attacker public keys.
Checked Arithmetic Everywhere Rust in debug mode catches integer overflow, but release builds on Solana BPF silently wrap around unless checked math methods are strictly enforced.
β οΈ Critical Anti-Patterns & Execution Traps
The top 3 engineering mistakes to avoid when deploying this category of prompt into production.
Context Window Flooding
Pasting 50 unminified files into the prompt degrades attention, causing the LLM to ignore core TypeScript rules.
Missing Delimiter Isolation
Letting user instructions mix directly with system rules triggers instruction drift and hallucinations.
Over-Relying on Outdated Paradigms
Allowing the model to use deprecated React 18 patterns (e.g. useEffect for data fetching) creates security vulnerabilities.
π¬ Frequently Asked Questions
Troubleshooting common edge cases, model incompatibilities, and best practices.
Can this audit Anchor programs written in older versions (e.g. Anchor 0.28)?
Yes, but it will explicitly flag deprecated macro syntax and recommend upgrading to Anchor 0.30+.
Does Solana have reentrancy bugs like Ethereum?
Solana does not allow arbitrary reentrancy into the same instruction, but cross-program invocation state desynchronization can produce identical drain exploits.
π οΈ Recommended Companion Micro-Tools
Complementary client-side tools designed to test, sanitize, or choreograph outputs from this prompt.
Vibe Coding Prompt Architect (.cursorrules Studio)
Generate production-grade .cursorrules, .windsurfrules, and CLAUDE.md for Next.js 15, FastAPI, and Go with zero-hallucination guardrails.
Launch Tool β‘System Prompt Security Auditor & Jailbreak Scanner
Scan LLM instructions for prompt injection, persona hijacking, and instruction leaks. Score defense 0-100 and auto-harden in 0ms.
Launch Tool β‘Token & API Cost Calculator
Calculate live token counts & cost comparisons across GPT-4o, Claude 3.5, and DeepSeek-R1 with prompt caching discounts.
Launch Tool β‘Cursor AI & Claude 3.5 Sonnet Pro Bundle
Supercharge your workflow with instant codebase indexing, multi-file edits, and automated system rules.
Explore Related AI Coding & Rulesets Prompts View all β
Claude 3.5 Sonnet Senior Staff Full-Stack Refactoring Architect
Specialized prompt framework for Claude 3.5 Sonnet and Claude 3.7. Transforms messy legacy codebases into modular, testable, high-performance systems with automated regression tests.
cursorCursor AI (.cursorrules) for Next.js 15, React 19 & Tailwind CSS
Stops Cursor from writing outdated Next.js 13 patterns, Pages Router syntax, or deprecated React hooks. Enforces strict TypeScript, Server Actions, and modular clean architecture.
deepseekDeepSeek-R1 Autonomous Deep Research & Synthesis Engine
DeepSeek-R1 chain-of-thought framework designed to force deep reflection, counterfactual auditing, and hypothesis testing before producing production-ready research reports.