crytic / crytic/slither

A detector for [ERC-7562](https://eips.ethereum.org/EIPS/eip-7562) banned opcodes reachable from an ERC-4337 validation function (`validateUserOp`, `validatePaymasterUserOp`), following internal calls, library calls and modifiers.

Open
#3,095 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the desired feature

## Why

ERC-7562 is enforced by bundlers, off-chain, in a tracer. **Nothing on-chain enforces it.** A paymaster that reads `block.timestamp` during validation compiles, passes its tests, passes a real `EntryPoint.handleOps` call, and is then dropped by every bundler in production, after it has been deployed and staked. Nothing a developer runs before deploying catches it today.

## What Slither catches today

`tx-origin` does flag the ORIGIN case when the read sits in a conditional, for its own phishing
reason. The rest is missed. On a paymaster that stores `block.timestamp` into its returned
context and checks `block.number` in a modifier:

```
$ slither Overlap.sol --detect timestamp,tx-origin,weak-prng
INFO:Slither:Overlap.sol analyzed (2 contracts with 3 detectors), 0 result(s) found
```

`timestamp` fires on comparisons and `weak-prng` on a modulo; these are an assignment and a
modifier. Nine more banned opcodes have no coverage in this context, and no detector models
"reachable from a validation entry point", which is what decides whether the contract works.

## Scope (v1)

OP-011 opcodes (TIMESTAMP, NUMBER, COINBASE, PREVRANDAO, GASLIMIT, BASEFEE, BLOBBASEFEE, ORIGIN,
GASPRICE, BLOCKHASH, BLOBHASH, SELFDESTRUCT) including inline-assembly spellings, plus OP-080
BALANCE reported with its staked-entity condition. Entry points matched by name, so a contract
that declares its own interface with a wrong argument list is still checked. GAS, CREATE/CREATE2
and the storage rules are left out: they need data flow to avoid false positives. Medium impact,
High confidence.

## Evidence

Working implementation, with fixtures and snapshot tests on solc 0.5.16 and 0.8.26.

| Target | Result |
|---|---|
| `eth-infinitism/account-abstraction` v0.8.0, all contracts | **0 findings** |
| A widely deployed production paymaster | **1 finding**: an ORIGIN read enforcing a bundler allowlist |

The second is a documented trade-off rather than a bug, since the read is gated behind a flag
that operators set per operation. It is also a fair statement of the limitation: the detector
reports reachability and cannot see that the read is optional.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Slither's existing timestamp, tx-origin, and weak-prng detectors, then examine the working implementation, fixtures, and snapshot tests mentioned in the issue. Validate the detector against solc 0.5.16 and 0.8.26 and the listed account-abstraction and paymaster targets. Done means the scoped OP-011 and OP-080 cases are reported through validation entry points while the explicitly excluded rules remain out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, solidity
Domain
blockchain, devtools, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.