Submitted by T1MOH, also found by merlin and klau5
https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/SafeModerator.sol#L80-L86
https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/SafeModeratorOverridable.sol#L86-L92
GnosisSafe has concept of module. Trusted modules of GnosisSafe contract can execute arbitrary transactions without signatures once enabled. Thats the main purpose of protocol: to allow the execution of some defined action (like swap on DEX) without signatures via registering such an action in Policy commitment. Then, execute this action via Executor or Main Account without need of delegatees signatures, and also allow one to register SubAccounts and manage them via Main Account.
Therefore, ExecutorPlugin and Main Account are enabled as modules. The main problem is that all transactions executed via module will fail, meaning SubAccount is just another GnosisSafe without additional utility. When assessing the severity, I took into consideration protocol specific: protocol is about adding new functionality.
But core functionality of protocol regarding ExecutorPlugin and SubAccounts doesnt work. Due to this reasoning I submit it as High, despite there is no financial loss.
Lets take a look on how tx from module is executed:
First, guard.checkModuleTransaction() is called, which returns bytes32 guardHash, and then transaction is executed:
https://github.com/safe-global/safe-contracts/blob/810fad9a074837e1247ca24ac9e7f77a5dffce19/contracts/base/ModuleManager.sol#L82-L104
In context of Brahma, Guard contract is SafeModerator or SafeModeratorOverridable. They implement the incorrect interface IGuard, so the function checkModuleTransaction() returns nothing.
https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/interfaces/external/IGnosisSafe.sol#L110-L116
Here is PoC in Remix to ensure that function reverts when trying to decode output while the function doesnt return anything:
As a result, the function GnosisSafe.execTransactionFromModule() will always revert.
Remix
Update interface IGuard:
The protocol is meant to use 1.5.0; the feature with callback to guard in module transactions was introduced in 1.5.0 recently. I also advise to add tests for different safe Versions; now only 1.3.0 is used in tests
The sponsor said they took interface from this PR because GnosisSafe 1.5.0. is still in development. In further discussion, they noted mistake in the interface.
Error
0xad1onchain (Brahma) commented:
0xad1onchain (Brahma) confirmed and commented:
0xsomeone (judge) decreased severity to Medium and commented:
0xad1onchain (Brahma) commented:
For this audit, 8 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by immeas received the top score from the judge.
The following wardens also submitted reports: radev_sw, alexzoid, GREY-HAWK-REACH, Arz, sorrynotsorry, Alra, and rvierdiiev.
