example-fork-detection
TEMPLATE — replace with the description of your rule. Should activate on the specific code patterns your fork has. Activate on…
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.
Claude Code
$ npx -y skills add omermaksutii/RugProof --skill inline-assembly --agent claude-code
Codex
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a codex -y
Cursor
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a cursor -y
Gemini CLI
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a gemini-cli -y
GitHub Copilot
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a github-copilot -y
OpenCode
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a opencode -y
Windsurf
$ npx skills add omermaksutii/RugProof --skill inline-assembly -a windsurf -y
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
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…