RunPrompt Pro
deepseek Audit Grade
β˜… 4.99 (4.720 uses)

Solidity Smart Contract Reentrancy & Flash Loan Attack Auditor

Trained on post-mortem analyses of $500M+ DeFi exploits. Deconstructs contract logic step-by-step to expose zero-day edge cases before mainnet deployment.

Verified for 2026 Engine Updates β€’ Last Updated: 2026-10-31

Parametric Customizer & Compiler Live Tool

Adjust the variables below. The prompt code and API payload update dynamically in real time.

4720 uses

Specifies business logic and economic attack vectors.

Identifies EVM opcode level vulnerabilities.

Directs DeepSeek R1 reasoning tokens toward specific failure modes.

Paste your smart contract functions or interface logic here.

Ready-to-Run Compiled Prompt
0 words β€’ 0 tokens β€’ Est: <$0.0001
Act as a Principal Smart Contract Security Auditor and Certified Ethical Hacker (CEH) specializing in EVM bytecode and DeFi protocol exploits. Audit the provided Solidity smart contract.

### CONTRACT CONTEXT:
- Target Protocol: Lending & Borrowing Collateral Vault (ERC-4626)
- Solidity Version: ^0.8.24 with transient storage (TSTORE / TLOAD)
- Primary Threat Model: Cross-function and Read-Only Reentrancy with external curve pools

### CONTRACT CODE:
```solidity
contract VulnerableBank {
    mapping(address => uint256) public balances;
    function deposit() external payable { balances[msg.sender] += msg.value; }
    function withdraw() external {
        uint256 balance = balances[msg.sender];
        require(balance > 0, "Zero balance");
        (bool success, ) = msg.sender.call{value: balance}("");
        require(success, "Transfer failed");
        balances[msg.sender] = 0;
    }
}
```

### AUDIT DIRECTIVES:
1. **Formal Threat Modeling**:
   - Check for classic Reentrancy (CEI pattern violations) AND cross-contract Read-Only Reentrancy.
   - Check for Flash Loan price oracle manipulation (spot AMM pool reserves vs. TWAP / Chainlink).
   - Check for ERC-4626 vault share inflation attacks, integer truncation, and unchecked low-level calls.

2. **Exploit Proof-of-Concept (Foundry Test)**:
   - Write an executable Foundry (`forge test`) Solidity PoC demonstrating the attack vector against the vulnerable function.

3. **Hardened Production Fix**:
   - Provide the fully patched contract code using OpenZeppelin ReentrancyGuardUpgradeable and custom errors.
Test Audit on DeepSeek R1 (Open API)

High-powered reasoning model with exceptional code decompilation capability.

⚑
Featured AI Partner Verified

Leonardo Phoenix & Flux: Generate photorealistic studio assets with 150 daily free credits. Zero setup required.

πŸ“Έ Real Sample Outputs & Verified Results

Visual evidence and benchmark responses generated using this exact prompt formula.

### DeepSeek R1 Audit Finding: **CRITICAL VULNERABILITY: Checks-Effects-Interactions (CEI) Pattern Violation.** In `withdraw()`, the external call `(bool success, ) = msg.sender.call{value: balance}("")` transfers ETH **before** resetting `balances[msg.sender] = 0`. An attacker contract fallback function can recursively call `withdraw()` to drain the entire contract balance. ### Executable Foundry PoC: ```solidity function testExploitReentrancy() public { attacker.attack{value: 1 ether}(); assertEq(address(bank).balance, 0); } ``` ### Mitigated Code: ```solidity balances[msg.sender] = 0; // Effect first! (bool success, ) = msg.sender.call{value: balance}(""); // Interaction second require(success, TransferFailed()); ```
DeepSeek R1 finding reentrancy vulnerability and generating automated Foundry test.

πŸ”¬ Prompt Engineering Anatomy

Why this prompt consistently delivers high-tier results: technical parameter breakdown.

1 Foundry (forge test) Executable PoC Directive

Instructing the AI to generate a runnable Foundry test forces the model to mathematically verify whether the attack is actually feasible, eliminating false positive alerts.

PRO TIP: Always request `vm.prank(attacker)` in the generated test suite.
2 Transient Storage (TSTORE) Opcode Audit

Solidity 0.8.24 allows cheap reentrancy guards via transient storage, but can cause bugs if state isn't cleared before next transaction.

PRO TIP: Use OpenZeppelin v5.0 contracts designed specifically for transient storage.

πŸ’¬ Frequently Asked Questions

Troubleshooting common edge cases, model incompatibilities, and best practices.

Can DeepSeek R1 replace a human smart contract audit firm?

No. While DeepSeek R1 excels at finding common vulnerabilities and generating Foundry PoCs, high-value protocols should always undergo peer reviews by certified firms.

How do I run the generated Foundry test?

Paste the PoC into your `test/` folder and run `forge test -vvvv` in your terminal.

Explore Related Blockchain & Smart Contracts Prompts View all β†’

πŸš€ Community Showcase

Submit Your Proven AI Prompt

Share your best prompt formula. Approved prompts get featured on RunPrompt with a backlink to your profile or website!

Prompts & Generative Tools
flux Cyberpunk Tokyo Streetwear Character Portrait Generator
Character & Fashion Concepts
claude ATS-Proof Executive Resume & Metric-Driven CV Rewrite Prompt
Career & Executive Growth
deepseek DeepSeek R1 Architecture & Security Vulnerability Code Auditor
AI Coding & Rulesets
cursor Cursor AI (.cursorrules) for Next.js 15, React 19 & Tailwind CSS
AI Coding & Rulesets
midjourney Luxury Perfume Studio Product Photography Prompt Generator
E-Commerce & Product Mockups
chatgpt High-Converting B2B SaaS Landing Page Copy Mega-Prompt
Direct Response Copywriting
cursor FastAPI, PostgreSQL & Supabase Production (.cursorrules)
AI Coding & Rulesets
flux Cinematic AI Video Camera Movement & Motion Generator
AI Video & Camera Motion
midjourney Minimalist 3D Claymorphic iOS App Icon & Logo Generator
Logos & App Icons
claude Viral Twitter / X Long-Form Educational Thread Architect
Social Media & Viral Growth
midjourney Malibu Oceanfront Brutalist Luxury Villa Architectural Digest Render
Architecture & Interior Design
cursor React Native & Expo Router Mobile App Production (.cursorrules)
AI Coding & Rulesets
claude 2026 Google AI Overviews & Semantic Entity Cluster Architecture Mega-Prompt
Search Strategy & Semantic SEO
midjourney Amazon A+ Content & Shopify Lifestyle Product Mockup Generator
E-Commerce & Amazon A+
deepseek Solidity Smart Contract Reentrancy & Flash Loan Attack Auditor
Blockchain & Smart Contracts
claude Hyper-Personalized B2B Cold Email Sequence with 40%+ Open Rates
B2B Sales & Cold Outreach
flux Invisible Ghost Mannequin Apparel & Fashion Mockup Generator
Fashion & Ghost Mannequin
flux Surreal Seamless Morphing & Physics Transformation Video Prompt
AI Video & Camera Motion
↑ ↓ Navigate ↡ Select
RunPrompt Spotlight
πŸ•’

Recent Generations

Your last 10 customized prompts generated in this session. Saved privately in your browser.

No recent prompts yet. Customize and copy any prompt to see your history here!
0 items stored