Signature Malleability in Verification #157
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
invalid
This doesn't seem right
withdrawn by warden
Special case: warden has withdrawn this submission and it can be ignored
Lines of code
https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/FighterFarm.sol#L206
https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/Verification.sol#L40
Vulnerability details
Impact
As highlighted in the EIP 865’s discussion, its current full implementation is affected by a signature malleability issue, steaming from the fact that in the current EIP, the recover function:
Allows both values 0/1 and 27/28 for v
Allows both lower and upper s values
ethereum/EIPs#865 (comment)
Signature malleability poses a security risk in systems that use these kinds of signatures as unique identifiers; as in the
Verification.sol
contract it usesecrecover
to recover thesigner
, this allows replay attacks, and thisverification.verify
is used in theFighterFarm.sol
:https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/FighterFarm.sol#L206
https://swcregistry.io/docs/SWC-117/
Proof of Concept
Tools Used
Manual review.
Recommended Mitigation Steps
Consider using OpenZeppelin’s ECDSA library: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol
Assessed type
Other
The text was updated successfully, but these errors were encountered: