Skip to content
Security
Command

/exploit

Generate a working Foundry PoC that exploits a specific finding. Compiles and passes.

From plugin
rugproof
1045 skills23 agents45 commands4 hooks
> /plugin marketplace add omermaksutii/RugProof
> /plugin install rugproof@rugproof

Command definition

exploit.md
description: Generate a working Foundry PoC that exploits a specific finding. Compiles and passes.
argument-hint: "<finding-id>  [--framework foundry|hardhat] [--story]"
allowed-tools: Read, Write, Edit, Bash, Agent, Skill, mcp__forge-runner__*

/exploit — write a working PoC

This is the headline feature. For a given finding ID, produce a Foundry test that:

1. Sets up the vulnerable state. 2. Executes the exploit. 3. Asserts the attacker gained value or the protocol was broken. 4. **Compiles.** 5. **The test passes when run.**

If `--story` is set, also produce a narrative "attack walkthrough" — punchy prose suitable for a tweet thread or blog post.

Procedure

Step 1 — Read the finding and the target

  • Pull finding `$ARGUMENTS[0]` from the latest audit.
  • Read the affected file and all imports it needs.
  • Note the function signatures, state vars, and any setup needed (e.g. funded balances, deployed dependencies like a Uniswap V2 pair).

Step 2 — Dispatch `exploit-poc-writer` subagent

The subagent writes the Foundry test. Use Foundry's `Test` base + `vm.prank`, `vm.deal`, `vm.warp`, `vm.expectRevert`, `vm.startPrank`, etc.

Structure:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "forge-std/Test.sol";
import {Vault} from "src/Vault.sol";
import {MaliciousReceiver} from "./MaliciousReceiver.sol";

contract ExploitREENT001 is Test {
    Vault vault;
    address attacker = makeAddr("attacker");
    address victim = makeAddr("victim");

    function setUp() public {
        vault = new Vault();
        vm.deal(victim, 10 ether);
        vm.deal(attacker, 1 ether);
        vm.prank(victim);
        vault.deposit{value: 10 ether}();
    }

    function test_Reentrancy_Drain() public {
        MaliciousReceiver bad = new MaliciousReceiver(vault);
        vm.deal(address(bad), 1 ether);
        vm.startPrank(attacker);

        bad.attack{value: 1 ether}();   // ← seed deposit + trigger reentrancy

        assertGt(address(bad).balance, 1 ether, "exploit failed to drain");
        assertLt(address(vault).balance, 1 ether, "vault not drained");
    }
}

Plus any auxiliary attacker contract.

Step 3 — Compile and run

Use the `forge-runner` MCP:

mcp__forge-runner__build()
mcp__forge-runner__test(test="test_Reentrancy_Drain")

If build fails: read the error, fix, retry. If test fails: read the trace, fix, retry.

**Hard requirement:** the test must pass before outputting. If after 3 attempts it doesn't pass, output a diagnosis and ask the user to verify the setup matches the deployed state.

Step 4 — Output

  • The full test file (path + content).
  • The forge-runner output showing the test passing.
  • If `--story` is set, also a 200-400 word "attack walkthrough":

> **How REENT-001 drains the Vault** > > The vulnerable function `Vault.withdraw()` sends ether before zeroing the balance. By depositing once and re-entering during the receive callback, an attacker can re-call `withdraw()` while their balance is still recorded as the full deposit. They withdraw the same balance repeatedly until the vault is empty. > > Step-by-step: … > > Cost: ~0.001 ETH gas. Profit: entire vault balance. Time: 1 block.

Step 5 — Save

Save the test to `test/exploits/Exploit<ID>.t.sol`. Mention this path in the output.

Notes

  • **The test MUST pass.** A PoC that doesn't run is worthless.
  • Don't over-mock — use the actual contract source where possible.
  • For exploits requiring mainnet state (oracle prices, deployed tokens), use `--fork-url` and a real block number. Note this in the test.
  • Be honest if the exploit needs an unrealistic precondition — say so.
Read more
@omermaksutii
Ships withrugproof

Rugproof your code before someone else does. 🌐 Live site: omermaksutii.github.io/RugProof 📦 Latest: v1.0.0 — 45 commands · 23 agents · 45 skills · 13 MCP servers · tested, offline-first, with rule packs, a benchmark, non-EVM coverage, and post-deploy

1052 skills23 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
10
Star history of omermaksutii/RugProof on GitHub, a chart by star-history.com

Other commands on rugproof.

audit-deep

audit-deep

Command

Deep audit — same as /audit but spawns more parallel subagents, runs multi-pass review, and chases exploit chains across files.

@omermaksutii@omermaksutiiInstall Command
audit-deps

audit-deps

Command

Audit third-party dependencies — resolve installed versions, cross-reference known-vulnerable releases, and flag vendored code…

@omermaksutii@omermaksutiiInstall Command
audit-diff

audit-diff

Command

Diff two Rugproof audit reports (before vs after) to track regressions — what's new, what's fixed, and whether the grade moved.

@omermaksutii@omermaksutiiInstall Command
audit-history

audit-history

Command

Pull past public audits (Code4rena, Sherlock, Spearbit, etc.) for a deployed contract or known protocol.

@omermaksutii@omermaksutiiInstall Command
audit-live

audit-live

Command

Audit a deployed contract on a live chain. Pulls verified source from the block explorer, optionally forks the chain for…

@omermaksutii@omermaksutiiInstall Command

More commands from other plugins.

deslop-reborn

deslop-reborn

Command

One iteration of the IronClaw Reborn de-slop loop — take ONE Reborn crate, fan out parallel review sub-agents (thermo-nuclear…

ironclaw12d13k
@nearai@nearaiInstall Command
audit

audit

Command

Audit a file, directory, or whole repo for insecure default configuration: fallback secrets, default credentials, fail-open…

@trailofbits@trailofbitsInstall Command
arsenal

arsenal

Command

Show which external bug-bounty tools are installed on this machine and print install hints for the missing ones. Curated from…

@awarexone@awarexoneInstall Command