/auditsentry:mev-frontrunningfrom auditsentry
Detects MEV exposure and front-running risks in Solidity smart contracts: missing slippage, manipulable deadlines, block-data randomness, commit-reveal gaps, permit race conditions. Activates on swaps, mints, liquidations, auctions.
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.
amountOutMin or slippage parametersfunction swap(address tokenIn, uint256 amountIn) external {
router.swapExactTokensForTokens(amountIn, 0, path, msg.sender, block.timestamp);
// ^ amountOutMin = 0 → 100% sandwichable
}
router.swap(..., block.timestamp); // ← deadline = now means no deadline at all
Searcher can delay your tx indefinitely. Use a real deadline (block.timestamp + 15 min or user-supplied).
Submitting permit() separately from the consuming tx lets an MEV bot front-run the permit and grief the user. Bundle in one tx.
function mintRare() external {
uint256 r = uint256(keccak256(abi.encode(block.timestamp, msg.sender)));
if (r % 100 == 0) _mint(msg.sender, RARE_ID); // ← searcher can simulate and skip
}
Searcher simulates → only sends tx if outcome is favorable. Use commit-reveal or Chainlink VRF.
block.prevrandao / block.difficulty for randomness (HIGH)Proposer can manipulate post-merge prevrandao within bounded ranges; predictable enough for valuable mints.
Bots will sweep entire allocation. Not a vuln per se but a UX/fairness issue worth flagging.
LPs in concentrated-liquidity pools can be JIT'd. Inform user, not a fix.
First-price sealed bids on a public mempool = bid front-run. Use commit-reveal.
Classic ERC-20 approve(spender, X) → approve(spender, Y) front-run lets spender drain X + Y. See [[approval-issues]].
| Pattern | Severity |
|---|---|
amountOutMin = 0 on user-facing swap | High |
Deadline = block.timestamp on user-facing swap | High |
| Block-data randomness for valuable outcomes | High |
| Commit-reveal missing on sealed bid | High |
| Permit + transferFrom unbundled | Medium |
| Bot-sweep risk on public NFT mint | Medium |
| JIT-LP exposure | Low |
| Display-only ordering issue | Info |
block.timestamp.permit (EIP-2612) or increaseAllowance.What SKILL.md sets; muted values are Claude Code's defaults
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.Other plugins' skills for the same job