Direct usage of ecrecover
allows signature malleability
#385
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
responded
The Holograph team has reviewed and responded
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographFactory.sol#L320-L335
Vulnerability details
Impact
The
_verifySigner
function of Holograph 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.
If the expected address is also the zero address (address(0)), the signature verification will pass although the signature is invalid.
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).
https://swcregistry.io/docs/SWC-117
https://swcregistry.io/docs/SWC-121
Proof of Concept
Tools Used
Manual Code Review
Recommended Mitigation Steps
Use the recover function from OpenZeppelin's ECDSA library for signature verification.
The text was updated successfully, but these errors were encountered: