example-fork-detection
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on…
Detect vulnerability to flash-loan-funded attacks — governance manipulation, price manipulation, collateral inflation, vault donation attacks. Activate when reviewing AMMs, lending protocols, governors, ERC-4626 vaults, staking with voting power, or any system whose state
Claude Code
$ npx -y skills add omermaksutii/RugProof --skill flash-loan-attacks --agent claude-code
Codex
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a codex -y
Cursor
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a cursor -y
Gemini CLI
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a gemini-cli -y
GitHub Copilot
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a github-copilot -y
OpenCode
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a opencode -y
Windsurf
$ npx skills add omermaksutii/RugProof --skill flash-loan-attacks -a windsurf -y
name: flash-loan-attacks description: Detect vulnerability to flash-loan-funded attacks — governance manipulation, price manipulation, collateral inflation, vault donation attacks. Activate when reviewing AMMs, lending protocols, governors, ERC-4626 vaults, staking with voting power, or any system whose state depends on its own balance.
function castVote(uint256 propId) external {
uint256 power = token.balanceOf(msg.sender); // ← spot balance
proposals[propId].votes += power;
}Fix: snapshot at `proposalCreated` via `ERC20Votes` checkpoints + sufficient voting delay.
First depositor mints 1 share, attacker sends huge `transfer` directly to vault → share price inflates → subsequent depositor's small deposit rounds to 0 shares.
// vulnerable mint math shares = assets * totalSupply / totalAssets; // ← totalAssets manipulable by direct transfer
Fix: virtual shares + virtual assets (OpenZeppelin v4.9+ ERC4626), or dead-shares pattern, or minimum first deposit.
function isHealthy(address user) public view returns (bool) {
uint256 collateralValue = oracle.spotPrice() * collat[user]; // ← spot
return collateralValue >= debt[user] * MIN_RATIO;
}Flash-loan moves spot → temporarily unhealthy → liquidator (attacker) takes collateral at discount. See [[oracle-manipulation]].
Snapshot-less reward math that integrates `balanceOf` at unpredictable moments.
Borrow rate as a function of `utilization = borrowed / supplied`. Flash-deposit → instantaneous low utilization → favorable borrow → flash-repay.
Take flash loan from A, deposit into B, manipulate B's price/rate, borrow from C, repay A — all in one block. Detect via: "this contract takes external balance into account in a single function."
Flash-loan governance token to claim bribes that are paid pro-rata to current holders.
| Pattern | Severity | |---|---| | Governance vote weight from spot balance | **Critical** | | ERC-4626 vault with no inflation protection | **Critical** | | Liquidation health check using spot price | **Critical** | | Bonding-curve / mint price tied to spot | **Critical** | | Reward distribution proportional to spot balance, claim is permissionless | **High** | | Utilization-rate function exploitable in single block | **High** | | Bribe market with spot-balance pro-rata distribution | **High** | | Display-only metric tied to spot balance | **Info** |
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…