Submitted by shw, also found by 0xito, JMukesh and pauliax
The verifySig function of Gravity calls the Solidity ecrecover function directly to verify the given signatures. However, the ecrecover EVM opcode allows malleable (non-unique) signatures and thus is susceptible to replay attacks.
Although a replay attack seems not possible here since the nonce is increased each time, ensuring the signatures are not malleable is considered a best practice (and so is checking _signer != address(0), where address(0) means an invalid signature).
Referenced code:
Gravity.sol#L153
SWC-117: Signature Malleability
SWC-121: Missing Protection against Signature Replay Attacks
Use the recover function from OpenZeppelins ECDSA library for signature verification.
jkilpatr (Althea) confirmed:
albertchon (judge) commented:
