Open hats-bug-reporter[bot] opened 1 year ago
It's up to the owner to decide if they'd discard the node module.
It's up to the owner to decide if they'd discard the node module.
This wasn't a documented option for the owner before the audit
All the possible actions that owners can do to their own Safe are not subject to modules. The fundamental model of Safe and Module are base on Safe being owner-centric and modules are complementary functional plug-ins.
Github username: @0xfuje Submission hash (on-chain): 0xc42262e4f11eeed7e0277029f551a59963b2c77f6e693c6f05ec8b2ddde92b62 Severity: medium
Description:
Impact
HoprNodeManagementModule
is disabled fromSafe
, makes essential functionality ofSafeStaking
inaccessibleDescription
Threshold is set to one at
Safe
's initialization, this means a single signer can disableHoprNodeManagementModule
: making core functionality ofSafeStaking by HOPR
unusable. Even if threshold is set to higher, multiple signers can collude to disable the node managementmodule
.src/node-stake/NodeStakeFactory.sol
-clone()
- (threshold of one at initialization)Note that while registering or de-registering a node in
NodeSafeRegitry.sol
ensureNodeIsSafeModuleMember()
is always called to make sure the module is registered, however after a node is registered (viaregisterSafeByNode()
) theHoprNodeManagementModule
can simply be disabled inSafe
viadisableModule()
. The registry will still treat it as a registered node-safe combination and returntrue
on calls made toisNodeSafeRegistered()
.vendor/solidity/safe-contracts-1.4.1/contracts/base/ModuleManager.sol
-disableModule()
Proof of Concept
packages/ethereum/contracts/test/node-stake/NodeStakeFactory.t.sol
ModuleManager
contract fromsafe-contracts
in the top of the file:HoprNodeStakeFactoryTest
(includes a helper function to execute safe transactions)run
forge test --match-test test_SafeDisableHoprModule -vvvv
Recommended Mitigation
Consider developing a
Safe Guard
contract to prevent disablingHoprNodeManagementModule
. It can be enabled inSafe
viaGuardManager.sol
-setGuard()
. Theguard
checks every transactions made withSafe
.vendor/solidity/safe-contracts-1.4.1/contracts/Safe.sol
-execTransaction()
checkAfterExecution()
of theguard
should check if theHoprNodeManagementModule
is still implemented after execution via querying fromModuleManager.sol
ofSafe
and checkingisModuleEnabled()
.