Cover photo

Ethereum replay attack

Overview

A replay attack is a kind of man-in-the-middle attack (simple version) in which an attacker sniffs messages being sent on a channel to intercept them and resend them under the cloak of authentic messages. What makes the replay attack particularly harmful is that the attacker does not even need to decrypt the message they resend but can still fool the receiver into thinking that the received message is legitimate.

Replay Attack Schema
Replay Attack Schema

Replay Attack On Chain

Financial institutions are often targets of replay attacks because attackers use it to copy transactions and take money directly out of unsuspecting accounts. While In the blockchain, replay attacks have great potential for disruption. This is because blockchain ledgers often undergo protocol changes or upgrades. Also known as a hard fork, this occurs when an existing ledger is split into two parts, one using an older version of the software and the other using a newer version. Usually, a hard fork is done to upgrade the ledger. However, a hard fork can also be initiated to form a new cryptocurrency.

During such a hard fork, malicious entities will use replay attacks to infiltrate the blockchain ledger. Any transactions made by people with valid access prior to the hard fork will also be valid on the updated system. This means that transactions made during the hard fork bypass blockchain security by replicating the transaction and transferring the same number of units on the attacker's account. Signed transactions are then validated on the old legacy system and the upgraded version as the upgraded blockchain nodes are unable to identify which chain the compromised transaction is for.

A Simple Scenario

  • You create a transaction that says “send 3 coins from my wallet to address Y.” You sign it, and you broadcast it to the BT2 network. The transaction circulates the BT2 network and is eventually confirmed, transferring 3 BT2 coins to address Y.

Make transaction on fork chain
Make transaction on fork chain
  • But somewhere along the line, somebody out there sees your transaction data, copies it, and re-uploads it to the BT1 network. Since there is no replay protection, the transaction is valid on the BT1 network as well.

Replay the transaction on mainnet
Replay the transaction on mainnet
  • The result is that not only are your 3 BT2 coins sent to address Y but so are your 3 BT1 coins! Except that those end up on address Y on the BT1 chain.

Potential replay attack on merge

One week before the merge event, Coinbase team member has proposed the potential replay attack and requested EthW team to make a change of chain id. It seemed that they intentionally to delay this change after the merge, which is extremely risky for users in mainnet. Although they did change the chain id before merge, but it’s really unprofessional to overlook this issue. That is probably why coinbase still did not list EthW and Binance only supports converting (selling). In conclusion, large scale replay attack chaos didn’t happen on chain, but some arbitrage strategies can implement on sepecific contracts by replaying transcation. Your funds on mainnet is SAFU.

Coinbase Request Screenshot
Coinbase Request Screenshot

Application On Merge

Replay attack implemented during merge is actually not the attack in chain scale, but targeted at sepecific protocol (Cross-chain bridge). As both EthW (10001) and EthFair (513100) have expoited different chain id from mainnet. However, some cross-bridge didn’t take notice of the forked contracts on EthW and EthFair chain (I personally think they really don’t care about this), and for assets (ether) crossed from mainnet to other evm chains, the original assets locked in the contract. So these contract got airdrop from EthW and EthFair as well, so getting these abandoned airdrops is attackers mutual goal. Top 2 victims are Omni Bridge and Polygon Bridge.

This attack is pretty simple to conduct, but the main point is owning large amount of ether. Every cross-chain operation consumed approximately 5$ (Ignoring the gas on EthW and EthFair), and the profit = $EthW + $EthF - 5$. Considering the price of EthW and EthF is currently 6$ and 0.7$ respectively, this is also the game for whales. Anyway, let’s try to excute the attack in detail (take polygon bridge and ethw as an example).

Steps

  • Bridge eth from Evm-Chain to Ethereum;

Polygon Bridge UI
Polygon Bridge UI

Conclusion

Replay attack is an old friend of blockchain, this first happened in ETC fork in 2016, repeating in BCH and BSV fork in 2018 and mutated in EthW fork in 2022. Usually attack implemented on maninnet to manipulate assets on it, but this time replay made profits by duplicating transaction on fork chain. Anon, we gotta Live and Learn.