Brahma - GREY-HAWK-REACH's results

Brahma Console is a custody and DeFi execution environment.

General Information

Platform: Code4rena

Start Date: 13/10/2023

Pot Size: $31,250 USDC

Total HM: 4

Participants: 51

Period: 7 days

Judge: 0xsomeone

Id: 295

League: ETH

Brahma

Findings Distribution

Researcher Performance

Rank: 13/51

Findings: 1

Award: $152.13

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: immeas

Also found by: Alra, Arz, GREY-HAWK-REACH, alexzoid, radev_sw, rvierdiiev, sorrynotsorry

Labels

bug
grade-a
QA (Quality Assurance)
sufficient quality report
edited-by-warden
Q-08

Awards

152.1324 USDC - $152.13

External Links

[N-01] Redundant getters for public mappings

Additional getters of public mappings are implemented. Either directly call the public mapping to retrieve the desired values, or make the mappings internal or private.

There are 3 instances of this issue:

File: src/core/AddressProvider.sol function getAuthorizedAddress(bytes32 _key) external view returns (address) { return authorizedAddresses[_key]; }

https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/AddressProvider.sol#L112-L114

File: src/core/AddressProvider.sol function getRegistry(bytes32 _key) external view returns (address) { return registries[_key]; }

https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/AddressProvider.sol#L121-L123

File: src/core/registries/WalletRegistry.sol function getSubAccountsForWallet(address _wallet) external view returns (address[] memory) { return walletToSubAccountList[_wallet]; }

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

[N-02] Typo in the function name

TransactionValidator.sol#L149 TransactionValidator.sol#L66

-   function _isConsoleBeingOverriden(
+   function _isConsoleBeingOverridden(
-       if (_isConsoleBeingOverriden(txParams.from, txParams.to, txParams.value, txParams.data, txParams.operation)) {
+       if (_isConsoleBeingOverridden(txParams.from, txParams.to, txParams.value, txParams.data, txParams.operation)) {

[N-03] EOAs access controls

EOAs can registerWallet() themselves and deploySubAccount's. Consider adding extra checks so only SafeWallets are able to do that.

[N-04] SafeHelper#_executeOnSafe - redundant code

SafeHelper.sol#L50-L78

Safe's code has the following line:

require(success || safeTxGas != 0 || gasPrice != 0, "GS013");

Because safeTxGas and gasPrice are hardcoded as zeroes, it can be deduced to require(success).

success == false - the execution reverts immediately. success == true - the execution is successful; execTransaction returns true.

Thus, it is impossible for execTransaction with safeTxGas == 0 and gasPrice == 0 to return false.

Recommendation

-   error SafeExecTransactionFailed();
    /* ... */
    function _executeOnSafe(address safe, address target, Enum.Operation op, bytes memory data) internal {
-       bool success = IGnosisSafe(safe).execTransaction(
+       IGnosisSafe(safe).execTransaction(
            address(target), // to
            0, // value
            data, // data
            op, // operation
            0, // safeTxGas
            0, // baseGas
            0, // gasPrice
            address(0), // gasToken
            payable(address(0)), // refundReceiver
            _generateSingleThresholdSignature(address(this)) // signatures
        );

-       if (!success) revert SafeExecTransactionFailed();
    }

[N-05] Guardian role is not tested/implemented

RegistriesRoles.md

[N-06] Consider enforcing the order of owner addresses in deployConsoleAccount

SafeDeployer.sol#L49

function deployConsoleAccount(
        address[] calldata _owners,
        uint256 _threshold,
        bytes32 _policyCommit,
        bytes32 _salt
    ) external nonReentrant returns (address _safe) {
+   uint256 ownersLengthMinusOne = _owners.length - 1;
+   for (uint i; i < ownersLengthMinusOne; i++){
+       require(_owners[i] < _owners[i + 1], "Wrong order");
+   }
    /* ... */

[N-07] Use timelock for changing the Governance

AddressProvider.sol#L48-L69

/** * @notice Governance setter * @param _newGovernance address of new governance */ function setGovernance(address _newGovernance) external { _notNull(_newGovernance); _onlyGov(); emit GovernanceTransferRequested(governance, _newGovernance); pendingGovernance = _newGovernance; } /** * @notice Governance accepter */ function acceptGovernance() external { if (msg.sender != pendingGovernance) { revert NotPendingGovernance(msg.sender); } emit GovernanceTransferred(governance, msg.sender); governance = msg.sender; delete pendingGovernance; }

#0 - c4-pre-sort

2023-10-22T23:02:44Z

raymondfam marked the issue as sufficient quality report

#1 - alex-ppg

2023-10-26T19:01:44Z

The comparative quality of the report is B as there are some valid recommendations that have been manually identified.

  • [N-01] While a valid bytecode-size reduction recommendation, this appears as a typical static-analysis output.
  • [N-02] Valid style recommendation yet potentially detect-able by static-analysis tools.
  • [N-03] The WalletRegistry::registerWallet is not security-sensitive, however, the WalletRegistry::registerSubAccount is. We can observe that the function applies adequate access control to ensure that the SafeDeployer is its caller and the SafeDeployer solely invokes it with a msg.sender argument as the _wallet, meaning that the listed absence of access control cannot affect the registry in a negative way.
  • [N-04] Valid gas optimization, will also result in the SafeExecTransactionFailed error to be eliminated from the code.
  • [N-05] Slightly low-effort, better suited as an "Analysis" finding .
  • [N-06] L214 of the SafeDeployer indicates that the Brahma team is aware of potential _owners orders affecting deployed wallet addresses and could potentially be a desirable trait .
  • [N-07] As the function already ensures the caller is the present governance of the contract, a time-delay is assumed to be in effect as all DAOs do have such security features built-in.

#2 - c4-judge

2023-10-26T19:01:52Z

alex-ppg marked the issue as grade-b

#3 - alex-ppg

2023-10-31T21:30:43Z

Based on the downgrade but acceptance of multiple QA findings, I will upgrade the grade of this QA report to A.

#4 - c4-judge

2023-10-31T21:30:49Z

alex-ppg marked the issue as grade-a

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter