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

any operation can pass without check

Summary

Mondrian wallet has a missing explicit check of the (ECDSA.recover ) function's return value.that return address(0) with invalid operation signature .

Vulnerability Details

If the signature is invalid or the recovery fails, ECDSA.recover might not return the expected value (address(0)).
The current implementation directly returns SIG_VALIDATION_SUCCESS irrespective of the ECDSA.recover outcome. This could lead to a vulnerability i:

The flawed validation process accepts the UserOp as valid due to the missing check.
the check-in handleOps function in the entrypoint contract based on this function
function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
external
virtual
override
requireFromEntryPoint
returns (uint256 validationData)
{
validationData = _validateSignature(userOp, userOpHash);
** _validateNonce(userOp.nonce);
_payPrefund(missingAccountFunds);
}

Impact

Unauthorized transactions could be processed through the EntryPoint contract if the signature validation is bypassed.

Tools Used

manuale review, remix

Recommendations

the Entry Point in ERC-4337 typically doesn't directly check the validation of the signature within a UserOperation.
need to check the returned address if it valid one
revert if the return is address(0)
Solidity
function _validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash)
internal
pure
returns (uint256 validationData)
{
bytes32 hash = MessageHashUtils.toEthSignedMessageHash(userOpHash);
address recoveredAddress = ECDSA.recover(hash, userOp.signature);
// check address with a mapping or carry to check this address is a valid one because there is no aggregator contract

// Check if the recovered address is valid (not zero)
require(recoveredAddress != address(0), "Invalid signature");

// Additional security checks based on recoveredAddress (optional)

return SIG_VALIDATION_SUCCESS;

}

Updates

Lead Judging Commences

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

ECDSA.recover should check against sender

Support

FAQs

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