Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

`MondrianWallet::_validateSignature` is not checking the recovered public key associated with a given signature is the same as the owner's key or not

Summary

  • MondrianWallet::_validateSignature is not checking the recovered public key associated with a given signature on a hash is the same as the owner's public key or not. if not, it should return SIG_VALIDATION_FAILED value.

Vulnerability Details

  • _validateSignature function always returns SIG_VALIDATION_SUCCESS. it is not checking the recovered public key associated with a given signature on a hash is the same as the owner's public key or not.

  • it does not return SIG_VALIDATION_FAILED when the signature validation fails.

function _validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash)
internal
pure
returns (uint256 validationData)
{
bytes32 hash = MessageHashUtils.toEthSignedMessageHash(userOpHash);
@> ECDSA.recover(hash, userOp.signature);
@> return SIG_VALIDATION_SUCCESS;
}

POC

  • Even if recovered public key associated with a given signature on a hash is not same as the owner's public key, the _validateSignature function should return SIG_VALIDATION_FAILED value. but, it always return SIG_VALIDATION_SUCCESS

  • if we put a wrong argument _validateSignature function, it should return SIG_VALIDATION_FAILED value. but, it always return SIG_VALIDATION_SUCCESS

Impact

  • It always returns SIG_VALIDATION_SUCCESS when the signature validation fails.

  • It allows an attacker to bypass the signature validation.

  • Not checking, the recovered public key associated with a given signature on a hash is the same as the owner's public key or not.

Tools Used

  • Manual Review

Recommendations

  • Update the MondrianWallet::_validateSignature function, to return a SIG_VALIDATION_FAILED value when the signature validation fails.

function _validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash)
internal
- pure
+ view
returns (uint256 validationData)
{
bytes32 hash = MessageHashUtils.toEthSignedMessageHash(userOpHash);
- ECDSA.recover(hash, userOp.signature);
+ if (owner() != ECDSA.recover(hash, userOp.signature)) {
+ return SIG_VALIDATION_FAILED;
+ }
return SIG_VALIDATION_SUCCESS;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

ECDSA.recover should check against sender

`_validateSignature` SHOULD return SIG_VALIDATION_FAILED (and not revert) on signature mismatch.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.