This functions use ecrecover function directly to verify the given signature. However, the ecrecover EVM opcode allows for malleable (non-unique) signatures and thus is susceptible to replay attacks.
Look in: ECDSA tryRecover checks
Attack scenario
In case of function delegateBySig on Comp contract the nonce change every time removing the possible replay attack
But in castVoteBySig on GovernorAlpha and castVoteBySig on GovernorBravoDelegate have the possibility of the replay attack
Affected smart contract
Description
This functions use
ecrecover
function directly to verify the given signature. However, theecrecover
EVM opcode allows for malleable (non-unique) signatures and thus is susceptible to replay attacks. Look in: ECDSA tryRecover checksAttack scenario
In case of function
delegateBySig
on Comp contract the nonce change every time removing the possible replay attack But incastVoteBySig
on GovernorAlpha andcastVoteBySig
on GovernorBravoDelegate have the possibility of the replay attackRecommendation
Use ECDSA library of OpenZeppelin