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 bugs in inline Yul / assembly — manual memory mismanagement, free-memory-pointer corruption, return-data manipulation, missing return-data-size checks, dirty-bits in narrow types. Activate on any `assembly { … }` block, Yul code, Solady-style assembly usage.
$ npx -y skills add omermaksutii/RugProof --skill inline-assembly --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/inline-assemblyContext preview
The summary Claude sees to decide when to auto-load this skill.
Detect bugs in inline Yul / assembly — manual memory mismanagement, free-memory-pointer corruption, return-data manipulation, missing return-data-size checks, dirty-bits in narrow types. Activate on any `assembly { … }` block, Yul code, Solady-style assembly usage.
name: inline-assembly
description: Detect bugs in inline Yul / assembly — manual memory mismanagement, free-memory-pointer corruption, return-data manipulation, missing return-data-size checks, dirty-bits in narrow types. Activate on any `assembly { … }` block, Yul code, Solady-style assembly usage.assembly {
let ptr := mload(0x40)
mstore(ptr, value)
// ← didn't bump 0x40, next allocation corrupts
}After writing memory, update `mload(0x40)` to past the write.
Yul scratch is `0x00-0x3F`. External calls / Solidity assignments may overwrite. Don't store across foreign-code boundaries.
assembly {
let ok := call(gas(), target, 0, in, insz, 0, 32)
returndatacopy(0, 0, 32)
let r := mload(0) // ← if target returned < 32 bytes, r has trailing memory garbage
}Check `returndatasize()` before copying.
A `uint8` read from calldata via `calldataload` has the high 248 bits unmasked. Mask with `and(..., 0xff)` before comparing.
assembly { return(0, calldatasize()) } // ← returns calldata; if function spec says bytes32, parsers blow upWriting to `0x60` (zero slot) is a known footgun — that slot must stay zero. Solidity uses it in mappings.
Reused scratch leaks data across functions.
Easy to write infinite loops or array-bound-violators.
Legacy opcodes still parseable but deprecated. `callcode` is the wrong delegatecall; `suicide` is `selfdestruct`.
`address` masked at 20 bytes; assembly users sometimes treat as full 32 bytes and leave dirty bits.
| Pattern | Severity | |---|---| | Free-memory-pointer corruption | **High** | | Unchecked returndatasize | **High** | | Dirty high bits on narrow type | **High** | | Wrong/legacy opcode | **High** | | Writes to 0x60 (zero slot) | **High** | | Reused scratch across foreign call | **High** | | Assembly returning misformatted ABI data | **High** | | Pure-Yul math with no overflow proof | **High** | | Comment-less assembly block in production code | **Low** *(maintainability)* |
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…