Lodestar-Finance / lodestar-protocol

Houses the code for the Lodestar Finance DeFi protocol.
BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

Direct usage of `ecrecover` allows signature malleability #31

Open rotcivegaf opened 1 year ago

rotcivegaf commented 1 year ago

Affected smart contract

Description

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

Recommendation

Use ECDSA library of OpenZeppelin

maarcweiss commented 1 year ago

False, no signature malleability in the contract due to it's nonce. It is a fork from compound also