code-423n4 / 2023-10-brahma-findings

8 stars 7 forks source link

No function to remove a subaccount #464

Closed c4-submissions closed 12 months ago

c4-submissions commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/registries/WalletRegistry.sol#L43-L55

Vulnerability details

Impact

A subaccount that has been taken over by an attacker can not be removed.

Proof of Concept

The WalletRegistry.sol contract has a registerSubAccount() function but does not have another function that can remove a subAccount in case a subAccount is compromised.

 /**
     * @notice Registers a sub account for a Safe
     * @param _wallet Console account address, owner of sub account
     * @param _subAccount Sub account address to register
     * @dev Can only be called by safe deployer
     */

    function registerSubAccount(address _wallet, address _subAccount) external {
        if (msg.sender != AddressProviderService._getAuthorizedAddress(_SAFE_DEPLOYER_HASH)) revert InvalidSender();
        if (subAccountToWallet[_subAccount] != address(0)) revert AlreadyRegistered();//@audit this condition does not mean already registered. How does he even change a wallet subaccount.
        subAccountToWallet[_subAccount] = _wallet;
        walletToSubAccountList[_wallet].push(_subAccount);
        emit RegisterSubAccount(_wallet, _subAccount);
    }

Tools Used

Manual Review

Recommended Mitigation Steps

Implement a removeSubAccount() function to remove a subAccount that has been compromised.

Assessed type

Other

c4-pre-sort commented 1 year ago

raymondfam marked the issue as low quality report

c4-pre-sort commented 1 year ago

raymondfam marked the issue as duplicate of #249

c4-judge commented 12 months ago

alex-ppg marked the issue as not a duplicate

c4-judge commented 12 months ago

alex-ppg marked the issue as duplicate of #410

c4-judge commented 12 months ago

alex-ppg marked the issue as unsatisfactory: Invalid

c4-judge commented 12 months ago

alex-ppg marked the issue as unsatisfactory: Invalid