Skip to content
Crypto Audit finding Advanced

Cross-chain replay attacks are possible with `changeRecipientAddress()`

The signed data for changing a recipient address did not include the chain ID, so a signature intended for one network could be replayed on another. An attacker could replay a user's mistaken cross-chain action to redirect funds to an address they control.

minhquanym Follow with JohnSmith and IllIllI

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-09-harpie-judging/tree/main/004-M

Found by

minhquanym, JohnSmith, IllIllI

Summary

Mistakes made on one chain can be re-applied to a new chain

Vulnerability Detail

There is no chain.id in the signed data

Impact

If a user does a changeRecipientAddress() using the wrong network, an attacker can replay the action on the correct chain, and steal the funds a-la the wintermute gnosis safe attack, where the attacker can create the same address that the user tried to, and steal the funds from there

Code Snippet

https://github.com/Harpieio/contracts/blob/97083d7ce8ae9d85e29a139b1e981464ff92b89e/contracts/Vault.sol#L60-L73

Tool used

Manual Review

Recommendation

Include the chain.id in what's hashed

Harpie Team

Added chainId to signature and signature validation. Fix here.

Lead Senior Watson

This is true assuming the contract address is the same across other chains. Confirmed fix.

The original report as published on Sherlock, by minhquanym. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

If a user calls changeRecipientAddress on the wrong network, an attacker could replay that action on the correct chain and steal the funds, similar to the Wintermute Gnosis Safe attack.

What the attacker needed

User signs changeRecipientAddress on wrong chain; contract deployed at same address on multiple chains

The fix

The fix was to include the chain ID in the signed data and in signature validation.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you sign a message with your crypto wallet, that signature can be used on any blockchain unless the message itself says which chain it is for. Here, the message did not include the chain ID, so a signature meant for one network could be reused on another. An attacker could take a user's mistaken action on the wrong network and replay it on the right one to steal funds.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by minhquanym

View all

28 more disclosed reports, best first.

More from Harpie

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.