Skip to content
critical Bridge / Cross-Chain No SWC entry CWE-284

Cross-Domain Authentication Failure

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

What goes wrong

A contract trusts a cross-domain message sender (e.g. L1->L2 messenger) but checks the wrong field, so messages from arbitrary senders are accepted as if from the trusted counterpart.

2

How to fix it

the pattern that is safe
function onMessage() external {
    require(msg.sender == address(messenger), "not messenger");
    require(messenger.xDomainMessageSender() == l1Counterpart, "bad origin");
    _act();
}
Validate xDomainMessageSender, not just the messenger.
Check your own contract for this

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