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 misuse of tx.origin, block.timestamp, block.number — phishing via tx.origin, timestamp dependence, L2-block-number assumptions. Activate on `tx.origin`, `block.timestamp`, `block.number`, `blockhash`, `block.prevrandao`, `block.coinbase`.
$ npx -y skills add omermaksutii/RugProof --skill tx-context-misuse --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/tx-context-misuseContext preview
The summary Claude sees to decide when to auto-load this skill.
Detect misuse of tx.origin, block.timestamp, block.number — phishing via tx.origin, timestamp dependence, L2-block-number assumptions. Activate on `tx.origin`, `block.timestamp`, `block.number`, `blockhash`, `block.prevrandao`, `block.coinbase`.
name: tx-context-misuse description: Detect misuse of tx.origin, block.timestamp, block.number — phishing via tx.origin, timestamp dependence, L2-block-number assumptions. Activate on `tx.origin`, `block.timestamp`, `block.number`, `blockhash`, `block.prevrandao`, `block.coinbase`.
require(tx.origin == owner); // ← phishable via intermediate contract
A contract the owner has interacted with can drain by calling back into this function — owner-EOA is `tx.origin` even if direct caller is the malicious contract.
Exception: `tx.origin == msg.sender` check to enforce EOA-only is *sometimes* valid for limiting bots — but EIP-7702 will invalidate even this. Flag as outdated pattern.
Miners (post-merge: validators) can skew timestamp ±~15s. Don't use for sub-15s precision.
uint r = uint(keccak256(abi.encode(block.timestamp, msg.sender))); // ← validator can simulate
Arbitrum: `block.number` is L1 block number, NOT L2. `block.timestamp` is L2. Optimism: `block.number` is L2. Get this wrong and rate limits fire 12x too fast (or too slow).
Random distribution becomes biased / predictable.
Validator can rotate addresses; using coinbase for auth or whitelisting is unsafe.
Post-merge `prevrandao` is the previous block's randao; validators can sometimes choose to skip producing a block to influence it (limited but real). Don't use for valuable mints.
Basefee can be manipulated within bounds by miners. Use sparingly.
Generally fine, but document tolerance for ±15s.
| Pattern | Severity | |---|---| | `tx.origin == admin` for sensitive auth | **High** | | `block.timestamp` as RNG seed for valuable outcomes | **High** | | `block.number` confused L1-vs-L2 on Arbitrum | **High** | | `block.coinbase` for auth | **High** | | `block.prevrandao` for high-value mint | **High** | | Timestamp deadline with <30s precision | **Medium** | | `blockhash` with out-of-range input | **Medium** | | EOA-only check via `tx.origin == msg.sender` | **Medium** *(EIP-7702 invalidates)* |
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…