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

Hooks are not triggered for `executeUserOp()`

Summary

Unlike other functions that execute operations from the account, the executeUserOp() function does not trigger hook callbacks.

Vulnerability Details

ERC-7579 hook modules are supported by the Nexus smart account implementation. Both the execute() and executeFromExecutor() functions are decorated with the withHook modifier.

119: function execute(ExecutionMode mode, bytes calldata executionCalldata) external payable onlyEntryPointOrSelf withHook {
137: function executeFromExecutor(
138: ExecutionMode mode,
139: bytes calldata executionCalldata
140: ) external payable onlyExecutorModule withHook withRegistry(msg.sender, MODULE_TYPE_EXECUTOR) returns (bytes[] memory returnData) {

The withHook modifier executes the preCheck() and postCheck() callbacks if any hook module is installed.

60: modifier withHook() {
61: address hook = _getHook();
62: if (hook == address(0)) {
63: _;
64: } else {
65: bytes memory hookData = IHook(hook).preCheck(msg.sender, msg.value, msg.data);
66: _;
67: IHook(hook).postCheck(hookData);
68: }
69: }

However, the modifier is absent in the executeUserOp() function. Since this function also handles execution from the account, it should trigger the hooks, as required by the ERC-7579 standard:

Hooks are an OPTIONAL extension of this standard. Smart accounts MAY use hooks to execute custom logic and checks before and/or after the smart accounts performs a single or batched execution. To comply with this OPTIONAL extension, a smart account:

  • MUST call the preCheck function of one or multiple hooks during an execution on the account

  • MUST call the postCheck function of one or multiple hooks during an execution on the account

Impact

Hook callbacks are not triggered during execution in the executeUserOp() function.

Tools Used

None.

Recommendations

Decorate the executeUserOp() function with the withHook modifier.

Updates

Lead Judging Commences

0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

finding-executeUserOP-no-hook-check-withhook

Invalid, [hooks are optional for the protocol](https://eips.ethereum.org/EIPS/eip-7579#hooks), and is only used to check for module installation, so if the eventual user action is to install a module via invoking `executeUserOp` using the entry point, the appropriate hook checks will still be invoked.

Appeal created

adriro Submitter
10 months ago
0xnevi Lead Judge
10 months ago
0xnevi Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

finding-executeUserOP-no-hook-check-withhook

Invalid, [hooks are optional for the protocol](https://eips.ethereum.org/EIPS/eip-7579#hooks), and is only used to check for module installation, so if the eventual user action is to install a module via invoking `executeUserOp` using the entry point, the appropriate hook checks will still be invoked.

Support

FAQs

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