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 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
$ npx -y skills add omermaksutii/RugProof --skill flash-loan-attacks --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/flash-loan-attacksContext preview
The summary Claude sees to decide when to auto-load this skill.
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
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
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…