Typed data for another chain can be signed: domain.chainId is never checked against the active network #519

Closed
opened 2026-10-14 04:45:12 +02:00 by clawbot · 1 comment
Collaborator

Where

eth_signTypedData_v4 and eth_signTypedData: the request handler in src/background/index.js (lines 1009-1048) and the signature screen in src/popup/views/approval.js. Neither compares the typed data's domain.chainId with the active network.

What happens

On next (8e52528), release build, Chrome, wallet on Sepolia: a connected site asks for an EIP-2612 Permit whose domain is mainnet USDC (chainId: 1, verifyingContract 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48). The screen opens under the [TESTNET] banner, shows the token permission warning and chainId: 1 as one plain line of the domain, and Sign is enabled. Signing gives the site a permit that is valid on mainnet, from a user who believes the wallet is on a testnet.

What should happen

EIP-712, chainId: "The user-agent should refuse signing if it does not match the currently active chain." A typed-data request whose domain.chainId is present and differs from the active network's chain id should be shown with Sign disabled and the reason on the error line, as the screen already does for a primary type it will not sign.

Severity: major

Definition of done

  • Typed data whose domain.chainId differs from the active network's chain id cannot be signed, and the screen says why.
  • Typed data without a domain.chainId, or with the active one, signs as now.
  • Tests cover both cases.

Model: opus-5-5

## Where `eth_signTypedData_v4` and `eth_signTypedData`: the request handler in `src/background/index.js` (lines 1009-1048) and the signature screen in `src/popup/views/approval.js`. Neither compares the typed data's `domain.chainId` with the active network. ## What happens On `next` (8e52528), release build, Chrome, wallet on Sepolia: a connected site asks for an EIP-2612 `Permit` whose domain is mainnet USDC (`chainId: 1`, `verifyingContract` `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`). The screen opens under the `[TESTNET]` banner, shows the token permission warning and `chainId: 1` as one plain line of the domain, and Sign is enabled. Signing gives the site a permit that is valid on mainnet, from a user who believes the wallet is on a testnet. ## What should happen EIP-712, `chainId`: "The user-agent should refuse signing if it does not match the currently active chain." A typed-data request whose `domain.chainId` is present and differs from the active network's chain id should be shown with Sign disabled and the reason on the error line, as the screen already does for a primary type it will not sign. Severity: major ## Definition of done - [ ] Typed data whose `domain.chainId` differs from the active network's chain id cannot be signed, and the screen says why. - [ ] Typed data without a `domain.chainId`, or with the active one, signs as now. - [ ] Tests cover both cases. Model: opus-5-5
clawbot self-assigned this 2026-10-14 04:45:12 +02:00
Author
Collaborator

Fixed in #544. The sign screen now refuses typed data whose domain chainId names a chain other than the active network, with the reason on its error line and Sign disabled. The background refuses the returned signature too, against the network active when it arrives. Typed data with no chainId signs as before.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/AutistMask/pulls/544. The sign screen now refuses typed data whose domain `chainId` names a chain other than the active network, with the reason on its error line and Sign disabled. The background refuses the returned signature too, against the network active when it arrives. Typed data with no `chainId` signs as before. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#519