Closed code423n4 closed 1 year ago
trust1995 marked the issue as unsatisfactory: Invalid
Because it signs a unique proposalId, it does not need replay protection.
@trust1995 Ser,
With due respect to decision, I think the hash data should be provided with incremented nonce.
I crossed check with openzeppelin castVoteBySig() implementation of Governor.sol, There incremented nonce is present in hash data.
Request to have a look.
Thank you!
Have considered it and unless you can show an abuse of the scheme used in Maia, the decision stands.
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/governance/GovernorBravoDelegateMaia.sol#L344-L352
Vulnerability details
Impact
In GovernorBravoDelegateMaia.sol,
The castVoteBySig() is used for Casting a vote for a proposal by signature. This function accepts EIP-712 signatures for voting on proposals. The issue here is Nonce is missing here in signed data. A nonce can prevent an old value from being used when a new value exists. Without one, two transactions submitted in one order, can appear in a block in a different order.
EIP-712 has stressed on security issues like Replay attacks which is possible here and Frontrunning attacks. Therefore all possible measures must be taken to prevent signature replay attacks i.e by providing incremented nonce in signed data.
EIP-712 security consideration link- https://eips.ethereum.org/EIPS/eip-712
To understand how signature replay attacks work, Please refer chapter link from Mastering Ethereum book, https://github.com/ethereumbook/ethereumbook/blob/develop/06transactions.asciidoc
Proof of Concept
https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/governance/GovernorBravoDelegateMaia.sol#L344-L352
References
Reference 1:- Referrencing here openzeppelin Governor.sol for understanding and mitigation implementation, In openzeppelin Governor.sol,
check,
See how nonce is incremented here using _useNonce(..) to prevent signature replay attacks.
Reference link
Reference 2:- In ERC20MultiVotes.sol, delegateBySig() function is prevented by signature replay attacks as this function has incremented nonce in signed data.
Reference link
Tools Used
Manual review
Recommended Mitigation Steps
Consider the incremented nonce in signed data to prevent signature replay attacks. Refer the given both references for the similar implementation to mitigate this issue.
Assessed type
Other