Replay Attack – Understanding Replay Attacks in Blockchain

accountsattackskeymanagementreplay-attacktestnets

During the launch of the frontier network, users were cautioned not to reuse keys from the Olympic testnet in order to prevent "replay attacks". What is a replay attack, and why would re-using a key from the testnet make someone vulnerable to one?

Best Answer

A replay attack is a valid data transmission that is maliciously or fraudulently repeated or delayed.

Extending this to blockchains, a replay attack is taking a transaction on one blockchain, and maliciously or fraudulently repeating it on another blockchain.

For example, an attacker taking someone's testnet transaction, and repeating it on the "real" blockchain, to steal "real" funds.

As @libertylocked commented, EIP 155 Simple replay attack protection has been implemented.

More Info

In Bitcoin, addresses in testnet use a different prefix from addresses in mainnet: thus keys are different.

In Ethereum, there are currently no "prefixes". (Probably done to keep creation of new addresses simpler.) So a transaction signed by a key, that is valid on one Ethereum network/chain, is valid for all Ethereum chains.

This means that if in "testing", funds are sent from accountB to accountTest, that same transaction can be replayed (broadcasted) to the public Ethereum blockchain: a replay attack. The replay attack will "succeed" if accountB does have funds on the public blockchain. To fully succeed, an attacker would need to know the private key to accountTest to steal the funds, but given that accountTest was created for testing, its private key may not be secure (maybe it is just a "brainwallet" with password "test").

Replay attacks are eliminated by using different addresses/keys between the frontier network, and all other Ethereum chains. (A little like using a different password for valuable stuff, from less valuable or less trustworthy websites.) Also see: How to prevent a replay attack between two competing chains? and as noted by @libertylocked comment, EIP 155 Simple replay attack protection has been implemented.

Related Topic