Methods used by EntryPoint has onlyOwner modifier
The execute and executeBatch functions in SmartAccount.sol are restricted to the owner by an onlyOwner modifier, but they are also intended to be callable by the EntryPoint contract. This breaks the interaction with EntryPoint, preventing the account from executing transactions via UserOperations.
Submitted by immeas, also found by Kutu, 0xDave, betweenETHlines, hansfriese, wait, peanuts, hihen, prc, 0xbepresent, and HE1M
contracts/smart-contract-wallet/SmartAccount.sol#L460-L461 contracts/smart-contract-wallet/SmartAccount.sol#L465-L466
execute and executeBatch in SmartAccount.sol can only be called by owner, not EntryPoint:
File: SmartAccount.sol
460: function execute(address dest, uint value, bytes calldata func) external onlyOwner{
461: _requireFromEntryPointOrOwner();
462: _call(dest, value, func);
463: }
464:
465: function executeBatch(address[] calldata dest, bytes[] calldata func) external onlyOwner{
466: _requireFromEntryPointOrOwner();
467: require(dest.length == func.length, "wrong array lengths");
468: for (uint i = 0; i < dest.length;) {
469: _call(dest[i], 0, func[i]);
470: unchecked {
471: ++i;
472: }
473: }
474: }
From EIP-4337:
- Call the account with the
UserOperation’s calldata. It’s up to the account to choose how to parse the calldata; an expected workflow is for the account to have an execute function that parses the remaining calldata as a series of one or more calls that the account should make.
Impact
This breaks the interaction with EntryPoint.
Proof of Concept
The reference implementation has both these functions without any onlyOwner modifiers:
56: /**
57: * execute a transaction (called directly from owner, not by entryPoint)
58: */
59: function execute(address dest, uint256 value, bytes calldata func) external {
60: _requireFromEntryPointOrOwner();
61: _call(dest, value, func);
62: }
63:
64: /**
65: * execute a sequence of transaction
66: */
67: function executeBatch(address[] calldata dest, bytes[] calldata func) external {
68: _requireFromEntryPointOrOwner();
69: require(dest.length == func.length, "wrong array lengths");
70: for (uint256 i = 0; i < dest.length; i++) {
71: _call(dest[i], 0, func[i]);
72: }
73: }
Tools Used
vscode
Recommended Mitigation Steps
Remove onlyOwner modifier from execute and executeBatch.
livingrockrises (Biconomy) confirmed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the onlyOwner modifier was added to execute and executeBatch, which conflicts with the internal check that allows either the EntryPoint or the owner to call them.
Impact
This breaks the interaction with EntryPoint, so the wallet cannot execute transactions through the standard account abstraction flow.
What the attacker needed
None
The fix
Remove the onlyOwner modifier from execute and executeBatch.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a smart contract wallet, the owner should be able to make the wallet perform actions, and a special trusted contract called EntryPoint should also be able to trigger actions on behalf of the owner. Here, a restriction meant only for the owner was accidentally applied to the functions that EntryPoint needs to call, so EntryPoint can no longer use them.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.