Skip to content
medium Bridge / Cross-Chain No SWC entry CWE-362

Cross-Chain Message Ordering Not Enforced

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

What goes wrong

Messages are processed in whatever order they arrive, but application logic assumes sequential delivery (e.g. state updates that must apply in order). A reordered or dropped message leaves state inconsistent or lets an attacker skip a step.

2

The vulnerable pattern

proof of concept — how it is exploited
// msg1 = 'set price', msg2 = 'buy at price'. If msg2 lands first,
// it executes against stale/zero price -> mispriced fill.
3

How to fix it

the pattern that is safe
require(nonce == expectedNonce[srcChain], "out of order");
expectedNonce[srcChain]++;
Enforce sequential nonces where ordering matters.
Check your own contract for this

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