HardhatFoundry
30,000 USDC
View results
Submission Details
Severity: low
Invalid

Non-compliance with EIP-4337

Description:

https://eips.ethereum.org/EIPS/eip-4337

validateUserOp() should return a time range, as per the EIP specifications:

  1. The return value MUST be packed of authorizer, validUntil and validAfter timestamps.
    authorizer - 0 for valid signature, 1 to mark signature failure. Otherwise, an address of an authorizer contract. This ERC defines “signature aggregator” as authorizer.
    validUntil is 6-byte timestamp value, or zero for “infinite”. The UserOp is valid only up to this time.
    validAfter is 6-byte timestamp. The UserOp is valid only after this time.`

The return value for validateUserOp() is just uint256 0 or 1 marking the success or failure of the signature validation

Impact:

SmartAccount is a EIP-4337 compliant, might not work properly

Proof Of Concept:

function validateUserOp(
PackedUserOperation calldata op,
bytes32 userOpHash,
uint256 missingAccountFunds
) external virtual payPrefund(missingAccountFunds) onlyEntryPoint returns (uint256 validationData) {
address validator = op.nonce.getValidator();
if (!op.nonce.isModuleEnableMode()) {
// Check if validator is not enabled. If not, return VALIDATION_FAILED.
if (!_isValidatorInstalled(validator)) return VALIDATION_FAILED;
validationData = IValidator(validator).validateUserOp(op, userOpHash);
} else {
PackedUserOperation memory userOp = op;
userOp.signature = _enableMode(validator, op.signature);
validationData = IValidator(validator).validateUserOp(userOp, userOpHash);
}
}
function validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash) external view returns (uint256) {
address owner = smartAccountOwners[userOp.sender];
if (
owner.isValidSignatureNow(ECDSA.toEthSignedMessageHash(userOpHash), userOp.signature) ||
owner.isValidSignatureNow(userOpHash, userOp.signature)
) {
return VALIDATION_SUCCESS;
}
return VALIDATION_FAILED;
}

Recommended Mitigation:

Refactor the code that is not compliant with the EIP-4337

Updates

Lead Judging Commences

0xnevi Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

finding-validateUserOp-validUntil-validAfter-ERC4337

Invalid, this check is performed in the entry point contract as seen in this instances [here](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/core/EntryPoint.sol#L605) --> [here](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/core/EntryPoint.sol#L574-L576)

Support

FAQs

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