Skip to content

Cross-Chain / Cross-Contract Signature Replay

SAFE-0045 Signatures Checked automatically by the scanner
1

What goes wrong

A signature valid on one chain or contract is replayed on another because the signed data omits chainId or the verifying contract address (no EIP-712 domain separator).

2

How to fix it

the pattern that is safe
bytes32 domain = keccak256(abi.encode(
    EIP712_DOMAIN, name, version, block.chainid, address(this)));
bytes32 h = keccak256(abi.encodePacked("\x19\x01", domain, structHash));
Bind signatures to chainId + contract via EIP-712 domain.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0045 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs