Remove owner calls can be replayed to remove a different owner at the same index, leading to severe issues when combined with lack of last owner guard
A cross-chain replayable owner-removal call could remove a different owner at the same index on another chain, potentially deleting the last accessible owner and permanently locking the account.
Submitted by Circolors, also found by lsaudit
Users are able to upgrade their account’s owners via either directly onto the contract with a regular transaction or via an ERC-4337 EntryPoint transaction calling executeWithoutChainIdValidation. If a user chooses to use a combination of these methods it’s very likely that the addresses at a particular ownership index differ across chain. Therefore if a user later calls removeOwnerAtIndex on another chain will end up removing different addresses on different chains. It is unlikely this would be the user’s intention. The severity of this ranges from minimal (the user can just add the mistakenly removed owner back) or critical (the user mistakenly removes their only accessible owner on a specific chain, permanently locking the account).
Proof Of Concept
Scenario A: Alice permanently bricks her account on an unused chain:
- Alice has a CoinbaseSmartWallet, and uses it on Base, Ethereum & Optimism
- Alice later decides to add a new owner using a cross-chain
executeWithoutChainIdValidation - Alice later wants to remove the initial owner (index 0) and does so by signing another cross-chain replayable signature
- Despite it not being her intention anyone could take that signature and replay it on Arbitrum, Avalanche, etc as there is no check to stop the user from removing the final owner
Scenario A: Alice adds owners using both methods and ends up with undesired results:
- Alice has a CoinbaseSmartWallet and uses it across all chains
- She has Gnosis Safe’s and ERC-6551 token bound accounts on different chains so adds them as owners on those specific chains using
execute - She then adds a secondary EOA address on all chains using
executeWithoutChainIdValidation - Now if she uses
executeWithoutChainIdValidationto callremoveOwnerAtIndeshe will be removing different owners on different chains, which is likely not her intention
While more complex scenarios than this might sound bizarre it’s important to remember that Alice could be using this smart account for the next N years, only making changes sporadically, and as her ownership mappings across different chains become more out of sync the likelihood of a significant error occurring increases.
Recommended Mitigation Steps
As MultiOwnableStorage uses a mapping to track owner information rather than a conventional array, it might be simpler to do away with the indexes entirely and have a removeOwner(bytes calldata _ownerToRemove) function. This would avoid the situations outlined above where when calling removeOwnerAtIndex removes different owners on different chains. To ensure replayability and avoid having a stuck nonce on chains where _ownerToRemove is not an owner the function should not revert in the case the owner is not there, but instead return a bool removed to indicate whether an owner was removed or not.
This would make it significantly less likely that users run into the issues stated above, without having to limit their freedom to make ownership changes manually or via ERC-4337 EntryPoint transactions.
3docSec (judge) increased severity to High and commented:
Root cause:
removeOwnerAtIndexcan be replayed cross-chain despite the same index may point to a different owner. The issue was confirmed by the sponsor in the issue #57 thread and addressed in this PR.After consulting with a fellow judge, I’m upgrading this one as high, as there is a well-defined attack path that causes the user to lose ownership of their wallet.
The issue is remediated by updating the parameterization of
removeOwnerAtIndexto also take anownerargument. We then check that theownerpassed matches the owner found at the index. In this way, we prevent a replayable transaction removing a different owner at the same index. (PR here)
Status: Mitigation confirmed. Full details in reports from McToady, cheatc0d3, and imare.
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 removal function identifies an owner only by index, and the signed call can be replayed across chains where the same index maps to a different owner.
Impact
The user could lose ownership of the wallet on a chain, and if the removed owner was the only accessible one the account is permanently locked.
What the attacker needed
Same smart wallet used on multiple chains; owners added via cross-chain replayable calls; signed removal call replayed on another chain
The fix
The removal function was changed to also take the expected owner address and check it matches the owner at that index, preventing a replay from removing a different owner.
How it was found
- Alice uses the same smart wallet on several chains.
- She adds owners on some chains with a normal transaction and on all chains with a cross-chain replayable transaction.
- She signs a cross-chain replayable call to remove the owner at a chosen index.
- Anyone can replay that signed call on another chain, where the same index holds a different owner.
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.
A smart wallet lets several 'owners' control it, and each owner sits at a numbered slot. A signed instruction to remove the owner in slot zero can be replayed on another blockchain, where slot zero may hold a different person. If that person was the only remaining owner, the wallet can no longer be controlled.
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.