example-fork-detection
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on…
Detect 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`.
Claude Code
$ npx -y skills add omermaksutii/RugProof --skill approval-issues --agent claude-code
Codex
$ npx skills add omermaksutii/RugProof --skill approval-issues -a codex -y
Cursor
$ npx skills add omermaksutii/RugProof --skill approval-issues -a cursor -y
Gemini CLI
$ npx skills add omermaksutii/RugProof --skill approval-issues -a gemini-cli -y
GitHub Copilot
$ npx skills add omermaksutii/RugProof --skill approval-issues -a github-copilot -y
OpenCode
$ npx skills add omermaksutii/RugProof --skill approval-issues -a opencode -y
Windsurf
$ npx skills add omermaksutii/RugProof --skill approval-issues -a windsurf -y
name: approval-issues description: Detect 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`.
token.approve(spender, X); // later token.approve(spender, Y); // ← spender can front-run and drain X+Y
Use `forceApprove(spender, Y)` (OZ ≥4.9), or `decreaseAllowance` / `increaseAllowance`, or zero-first.
USDT requires approve-to-zero before approve-to-X. Use OZ `forceApprove`.
token.approve(router, type(uint256).max); // ← router is upgradeable, future impl can drain
Mitigate with allowance-per-action.
Vault → strategy infinite approval; if strategy is upgradeable or has a bug, vault funds drainable.
Permit2 signatures are bearer instruments — anyone with the sig can transfer. If the signed payload is logged or leaked, funds are drainable until the nonce is invalidated. Add a deadline.
try IERC20Permit(token).permit(owner, spender, ...) {} catch {}
token.transferFrom(owner, ...); // ← if permit fails, uses any stale allowanceCaller can grief by front-running permit. Acceptable IFF you then check the allowance is sufficient.
Some tokens treat `approve(0, x)` as a no-op or revert. Use the documented revoke method.
token.safeApprove(target, amount); target.swap(...); // ← allowance lingers; if `amount` was max, target keeps power
Set to 0 after each action, or use a single-tx wrapper.
Deployer can deploy attacker-controlled implementation that consumes the approval.
| Pattern | Severity | |---|---| | Persistent infinite approval to upgradeable router | **High** | | Approve race ignored, no `forceApprove` / `increaseAllowance` | **High** | | USDT-style approve without zero-reset | **High** | | Vault → strategy infinite allowance with mutable strategy | **High** | | Permit2 with no deadline | **High** | | Permit failure swallowed, allowance not re-checked | **Medium** | | Lingering allowance after one-shot router action | **High** |
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
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on…
Detect unsafe assumptions about Solady's gas-optimized ERC20/ERC2612 permit and DN404 metadata. Solady's ERC20 uses custom…
Detect front-runnable ownership initialization in Solady Ownable / OwnableRoles. Solady's `_initializeOwner` is a guarded…
Detect Solady SafeTransferLib calls that assume the token has code. SafeTransferLib.safeTransfer/safeTransferFrom/safeApprove…
Detect Uniswap V4 hooks that fail to settle currency deltas with the PoolManager. Every credit/debit a hook creates…
Detect Uniswap V4 hooks whose address-encoded permission flags don't match the callbacks the hook actually implements. In V4 the…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…