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
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.
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.