Skip to content

chainId Not Bound in Cross-Chain Payload

SAFE-0247 Bridge / Cross-Chain Checked automatically by the scanner
1

What goes wrong

A signed or hashed cross-chain payload omits the destination chainId. A message intended for one chain can be replayed on another chain served by the same contract/validator set.

2

The vulnerable pattern

proof of concept — how it is exploited
// message hash = keccak256(nonce, to, amount) // no chainId
// same signed message is accepted on chain A and chain B -> double release.
3

How to fix it

the pattern that is safe
bytes32 id = keccak256(abi.encode(block.chainid, nonce, to, amount));
Include destination chainId in every cross-chain digest.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0247 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