/auditsentry:mev-pbsfrom auditsentry
Detects MEV and proposer-builder-separation vulnerabilities in smart contracts: sandwichable swaps, oracle frontrunning, JIT liquidity, false private-mempool assumptions, missing commit-reveal, and multi-block MEV. Activates on swap/liquidation/auction/redemption code.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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 |
minOut + deadline on every swap/redeem; reject 0 / type(uint).max defaults.minOut is computed off-chain from a fresh quote and passed in is fine — don't flag the presence of a slippage parameter.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mev, pbs, smart-contract-security, defi, frontrunning, sandwich-attack
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation./centralization-riskDetect centralization and trust-assumption risks — admin powers, single-key risk, missing timelocks, upgrade authority, treasury keys, pause permanence, blacklisting authority, oracle authority. Activate on `onlyOwner`, `onlyRole`, `AccessControl`, upgrade authorizations, pause/unpause functions, mint/burn caps, treasury/fee setters./confidence-scoringAlways-on meta-skill — for every finding produced, attach a confidence level (HIGH/MEDIUM/LOW) and a reasoning trace. Activate on every /audit, /audit-deep, /audit-changes, /audit-live, /quick-scan invocation./cosmwasmDetect bug classes specific to CosmWasm (Rust) contracts — missing info.sender authorization in execute handlers, unbounded map iteration → gas/DoS, reply/submessage reply_id confusion, migrate admin backdoors, addr_validate vs raw string addresses, unchecked info.funds, Uint128 overflow, query reentrancy, and migration/version state. Activate on any `.rs` file with `use cosmwasm_std`, `#[entry_point]`, `ExecuteMsg`, `InstantiateMsg`, `QueryMsg`, `cw_storage_plus`, or `DepsMut`.Other plugins' skills for the same job