It's unclear why Wormhole requires a nonce in the first place if they increment a sequence counter on each PostMessage.
The documentation also does not talk about it.
We still recommend best practices of not reusing cryptographic nonces to avoid the same transfer parameters failing due to resulting in the same hash if the sequence was not incremented.
Recommended Mitigation Steps
Use a counter as a nonce that is incremented each time. Store it in the contract's state.
Lines of code
https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/terra/contracts/wormhole-bridge/src/contract.rs#L482-L483
Vulnerability details
Impact
Nonces should only be used once by definition. However, all token transfers use the same hardcoded nonce.
It's unclear why Wormhole requires a nonce in the first place if they increment a sequence counter on each
PostMessage
. The documentation also does not talk about it. We still recommend best practices of not reusing cryptographic nonces to avoid the same transfer parameters failing due to resulting in the same hash if thesequence
was not incremented.Recommended Mitigation Steps
Use a counter as a nonce that is incremented each time. Store it in the contract's state.