code-423n4 / 2024-03-coinbase-findings

1 stars 0 forks source link

Smart wallet owners can avoid being removed by frontrun-removing other owners. #61

Open c4-bot-10 opened 8 months ago

c4-bot-10 commented 8 months ago

Lines of code

https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/MultiOwnable.sol#L102

Vulnerability details

Impact

The removeOwnerAtIndex function allows owners to be removed. The function can only be called by the owners or the contract itself. The issue is that owners can evade this removal by frontrunning the calls to the function and removing the owner that wants to remove them, thereby evading and consequently griefing other owners in the process.

The removeOwnerAtIndex holds the onlyOwner modifier which checks if the caller is an owner. Hence, only the owners can call.

    function removeOwnerAtIndex(uint256 index) public virtual onlyOwner {
        bytes memory owner = ownerAtIndex(index);
        if (owner.length == 0) revert NoOwnerAtIndex(index);

        delete _getMultiOwnableStorage().isOwner[owner];
        delete _getMultiOwnableStorage().ownerAtIndex[index];

        emit RemoveOwner(index, owner);
    }

By frontrunning the call to the function, and passing other owner's address, the to-be-removed owner can grief and potentially avoid being removed as an owner.

Proof of Concept

Tools Used

Manual code review

Recommended Mitigation Steps

A potential solution is limiting the calls to the removeOwnerAtIndex function to only the contract. Another potential solution is removing the function completely, as it introduces griefing vectors.

Assessed type

Other

c4-pre-sort commented 7 months ago

raymondfam marked the issue as sufficient quality report

c4-pre-sort commented 7 months ago

raymondfam marked the issue as duplicate of #18

raymondfam commented 7 months ago

Mimicking the exploit path of #57.

c4-pre-sort commented 7 months ago

raymondfam marked the issue as duplicate of #22

c4-pre-sort commented 7 months ago

raymondfam marked the issue as not a duplicate

c4-pre-sort commented 7 months ago

raymondfam marked the issue as duplicate of #57

c4-judge commented 7 months ago

3docSec marked the issue as not a duplicate

c4-judge commented 7 months ago

3docSec marked the issue as duplicate of #18

c4-judge commented 7 months ago

3docSec changed the severity to QA (Quality Assurance)

c4-judge commented 7 months ago

3docSec marked the issue as grade-a

3docSec commented 7 months ago

Hi @ZanyBonzy ,

I see your points, but all attacks require the attacker to have been previously added as a trusted owner, so even the most sophisticated attack can only come out of a serious mistake of the user who leaked the keys to their wallet. It can't be more than QA under this consideration.

PaperParachute commented 7 months ago

Closing while discussing internally

3docSec commented 7 months ago

Hi @ZanyBonzy sorry for the confusion. The issue was reopened accidentally while I was confirming with the C4 team whether QA findings like this one need to be open to be eligible for awards.

The answer is no: as soon as there is a grade-a or grade-b label, the findings will receive a share of the QA pot. So the issue can stay closed without impacting awarding