Replay Attacks And How They Can Affect Blockchains

A replay attack usually happens when blockchains alter or upgrade their protocols, a process known as a hard fork. It is a type of cybercrime where bad actors get hold of an original encrypted message during data transmission and use it to fool the system into carrying out the same transaction multiple times.

Due to a blockchain’s distributed nature, it is easy for attackers to eavesdrop on a communication. They can then repeat a valid data transmission and draw money from their victims’ accounts. Since the data is original, the network’s security protocols do not see the attack as a malicious event. Instead, it is seen as standard data transmission and goes through without facing any difficulty.

More likely during a hard fork

A replay attack is more likely during a hard fork. In such an event, the blockchain is split into two. Now members have access to two blockchains with identical information. In this case, bad actors may perform a replay attack on the new blockchain by using the transactions processed on the older network.

For instance, after a hard fork, Sam sends a certain amount of crypto to Alice on the new version of the blockchain. Alice can use this same transaction data on the old blockchain, receiving double the crypto.

However, this possibility can apply only to existing users who have been part of the hard fork. New users who have joined the network after the hard fork can neither carry out replay attacks nor will be vulnerable to them

How to stop replay attacks

Fortunately, replay attacks are easy to curb. There are several methods that blockchains can use to prevent such attacks; here are a few of them:

Random session key

In a random session key, a unique encryption and decryption code is generated between two users or two computers for every transaction. This is often called a symmetric key because it uses the same key for encryption and decryption. Since the security key is randomly generated, the same key will not be valid for a second time.

Using timestamps

This kind of message has an added layer of security: a timestamp on the message. Usually, this kind of message will also have a window of time by when the entire transaction should be completed. If a message is received after the window is closed, it will automatically get rejected.

Single-use password

In this case, each message is protected by a password that can be used only once! So, even if such a message is intercepted and re-sent, it will not be processed as the password expired after the first use.

New blockchain marker

After the hard fork, the new blockchain can implement a marker to protect itself from replay attacks. It ensures that transactions made on the new blockchain will not be valid on the legacy blockchain. The protection comes into effect immediately after the hard fork is implemented. Bitcoin Cash implemented this kind of protection when it separated from Bitcoin.

Conclusion

When successful, replay attacks present a significant threat to a blockchain and its users. It is one of the only attacks that does not require the decryption of network transmissions. Moreover, since attackers use real encrypted messages, replay attacks are harder to spot. They can lead to a user’s wallet being swiped clean.

In the worst scenario, the attacker can clog the system with repeated transmissions. This can be particularly disruptive to a hard-forked network that has lost a substantial amount of its computing power as users and nodes move to the newer version of the blockchain. In this case, a concerted replay attack can overwhelm the legacy blockchain’s already reduced mining capacity.

Fortunately, the attacker doesn’t have complete control over the network, and they cannot overwrite the blockchain. The scope of the damage or vulnerability is limited to old actions of someone being illegitimately repeated. Moreover, with the right protection measures, replay attacks can be permanently blocked from ever happening.