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

Validate signature does not actually validate signature

Summary

The function validateSignature is redundant as it always return SIG_VALIDATION_SUCCESS and does not fail .

Vulnerability Details

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); 
}

The function validateSignature used here does not actually validate,

the validateSignature check returns SIG_VALIDATION_SUCCESS and doesnt return anything else unlike what the document says 



 * @return validationData - Signature and time-range of this operation.
 *                          <20-byte> aggregatorOrSigFail - 0 for valid signature, 1 to mark signature failure,
 *                                    otherwise, an address of an aggregator contract.
 *                          <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite"
 *                          <6-byte> validAfter - first timestamp this operation is valid
 *                          If the account doesn't use time-range, it is enough to return
 *                          SIG_VALIDATION_FAILED value (1) for signature failure.
 *                          Note that the validation code cannot use block.timestamp (or block.number) directly.
 */
function _validateSignature(PackedUserOperation calldata uwserOp, bytes32 userOpHash)
    internal
    pure
    returns (uint256 validationData)
{
    bytes32 hash = MessageHashUtils.toEthSignedMessageHash(userOpHash);
    ECDSA.recover(hash, userOp.signature);
    return SIG_VALIDATION_SUCCESS;
}

As the docs says here it should return SIG_VALIDATION_FAILED if the signature validation didnt pass but it doesn't do that

Impact

High as it allows signatures that are not verified to get the account funds.

Tools Used

Manual Review

Recommendations

Add a part that returns SIG_VALIDATION_FAILED if the signature validation failed.

Updates

Lead Judging Commences

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

`_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.