example-fork-detection
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on `<your trigger keywords or…
Detect MEV and proposer-builder-separation exposure — sandwichable swaps with no minOut, JIT liquidity, oracle-update frontrunning, backrunnable state, false reliance on private mempools, builder censorship, missing commit-reveal, and multi-block MEV post-PBS. Activate whenever
$ npx -y skills add omermaksutii/RugProof --skill mev-pbs --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/mev-pbsContext preview
The summary Claude sees to decide when to auto-load this skill.
Detect MEV and proposer-builder-separation exposure — sandwichable swaps with no minOut, JIT liquidity, oracle-update frontrunning, backrunnable state, false reliance on private mempools, builder censorship, missing commit-reveal, and multi-block MEV post-PBS. Activate whenever
name: mev-pbs description: Detect MEV and proposer-builder-separation exposure — sandwichable swaps with no minOut, JIT liquidity, oracle-update frontrunning, backrunnable state, false reliance on private mempools, builder censorship, missing commit-reveal, and multi-block MEV post-PBS. Activate whenever code performs swaps/liquidations/auctions/redemptions whose ordering or price is observable in the public mempool before execution.
Trigger on any of:
function swap(uint256 amountIn) external {
uint256 out = router.swapExactTokensForTokens(amountIn, 0, path, ...);
// ^ minOut = 0
}**Signal:** `amountOutMin == 0` (or a deadline of `type(uint).max`) lets a searcher frontrun to move price, then backrun, extracting the full slippage. The user-facing call must accept a caller-supplied `minOut` and `deadline`, never hardcode 0.
A position becomes profitable to liquidate / mint the instant a Chainlink push or `updatePrice` lands. Searchers backrun the oracle tx in the same block. If your protocol grants the *liquidator* a fixed bonus, the value leaks to MEV; if redemptions price off a freshly-updated feed, frontrun the update.
Concentrated-liquidity add-just-before / remove-just-after a large swap captures fees from passive LPs without bearing inventory risk. Flag fee mechanics that reward liquidity present only at swap time.
// comment: "safe because we submit via Flashbots, never public"
**Signal:** security argument rests on transactions staying private. Private relays are best-effort, not guaranteed; post-PBS, builders may not include or may leak the bundle. On-chain logic must be safe even when public.
Auctions, randomness consumers, or fair-mints that reveal the winning input in the same tx are frontrunnable. No commit phase = bid sniping.
Post-Merge, a proposer controlling consecutive slots can execute multi-block MEV (e.g. hold price across two blocks). State that's only manipulation-safe within a single block is not safe under multi-block control.
| Pattern | Severity | Notes | |---|---|---| | minOut=0 / max deadline on user swap | **High** | Guaranteed sandwich loss | | Oracle-update frontrun → liquidation/redemption | **High** | Value leaks to searchers | | Security relies on private mempool | **High** | Assumption not enforceable on-chain | | Missing commit-reveal on auction/mint | **Medium** | Bid sniping | | JIT liquidity fee capture | **Medium** | LP value extraction | | Single-block-only safety vs multi-block MEV | **Medium** | Proposer with consecutive slots |
1. **Caller-supplied `minOut` + `deadline`** on every swap/redeem; reject 0 / `type(uint).max` defaults. 2. **Commit-reveal** for auctions, fair mints, and randomness consumption; or a sealed-bid scheme. 3. **Decouple action from oracle tick** — use TWAPs / time-weighted settlement so a single update isn't instantly exploitable; cap per-block price movement. 4. **Don't rely on privacy for safety** — treat the mempool as adversarial; if using MEV-Share/threshold encryption, still make on-chain logic safe when public. 5. **Multi-block-aware design** — require state to be safe across consecutive proposer slots; consider per-epoch rate limits.
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
Repo: omermaksutii/RugProof
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on `<your trigger keywords or…
Detect unsafe assumptions about Solady's gas-optimized ERC20/ERC2612 permit and DN404 metadata. Solady's ERC20 uses custom storage slots, returns bools via…
Detect front-runnable ownership initialization in Solady Ownable / OwnableRoles. Solady's `_initializeOwner` is a guarded one-time setter (it reverts with…
Detect Solady SafeTransferLib calls that assume the token has code. SafeTransferLib.safeTransfer/safeTransferFrom/safeApprove deliberately skip the EXTCODESIZE…
Detect Uniswap V4 hooks that fail to settle currency deltas with the PoolManager. Every credit/debit a hook creates (BeforeSwapDelta, afterSwap hookDelta,…
Detect Uniswap V4 hooks whose address-encoded permission flags don't match the callbacks the hook actually implements. In V4 the hook's permissions live in the…