hats-finance / Intuition-0x538dbadc50cc87b281cd655f1edbc6ebda02a66a

The smart contracts of the Intuition protocol v1.
https://intuition.systems
Other
0 stars 1 forks source link

AtomWallet does not fully respect ERC-4337 standard #86

Open hats-bug-reporter[bot] opened 3 days ago

hats-bug-reporter[bot] commented 3 days ago

Github username: -- Twitter username: @burnerelu Submission hash (on-chain): 0x0f336c0e954ad4133dff4950831ca5d667b42939442ee9ffca1dff0b77507a94 Severity: low

Description: Description\ ERC-4337 states the following: "(The account) .. MUST validate the signature is a valid signature of the userOpHash, and SHOULD return SIG_VALIDATION_FAILED (and not revert) on signature mismatch. Any other error MUST revert." (https://eips.ethereum.org/EIPS/eip-4337).

In the current AtomWallet implementation, the error return value of the ECDSA.tryRecover function is not checked. This way, regardless of the error signaled by the tryRecover function, the _validateSignature implementation will not revert.

Attack Scenario\ Not applicable

Attachments

  1. Proof of Concept (PoC) File

validateSigOriginal.sol - contains the function that does not respect the ERC-4337 standard

  1. Revised Code File (Optional) validateSigProposal.sol - contains two versions of the modified function - one that treats all ECDSA error types in a similar fashion and reverts using a generic error, and one that reverts with specific error types that also take errorArg into account.

A third option would be to call ECDSA.recover instead of ECDSA.tryRecover, as it is done in example https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/SimpleAccount.sol

Files:

mihailo-maksa commented 2 days ago

Our detailed perspective: