hats-finance / Inverter-Network-0xe47e52c4fea05e555920f1dcdcc6fb8eca103eeb

Fork of the Inverter Smart Contracts Repository
GNU Lesser General Public License v3.0
0 stars 3 forks source link

Anyone can initialize `OrchestratorFactory_v1.sol` and `ModuleFactory_v1.sol` implementation contracts #8

Open hats-bug-reporter[bot] opened 4 months ago

hats-bug-reporter[bot] commented 4 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xfe25a0c906257e4d19f35ede55b581b83d2a1dab4db90ac651fdcffa0cae5626 Severity: low

Description:

Description

OrchestratorFactory_v1.sol and ModuleFactory.sol are missing _disableInitializers() call in the constructor. An implementation contract can be taken over by an attacker with calling the init function which may cause unexpected functionality (it is very dangerous with delegatecalls).

Recommendation

From openzeppelin's documentation:

Do not leave an implementation contract uninitialized. An uninitialized implementation contract can be taken over by an attacker, which may impact the proxy. To prevent the implementation contract from being used, you should invoke the _disableInitializers function in the constructor to automatically lock it when it is deployed

PlamenTSV commented 3 months ago

selfdestruct() was removed, an initialized implementation is just a contract that's unusable. Since it cannot be destroyed to brick the proxy, this is a non-issue in my opinion.

0xfuje commented 3 months ago

selfdestruct() was removed, an initialized implementation is just a contract that's unusable. Since it cannot be destroyed to brick the proxy, this is a non-issue in my opinion.

selfdestruct()'s behaviour was changed, but only in compiler versions equal or above to 0.8.24: Solidity 0.8.24 announcement, and since the contracts use 0.8.23 the selfdestruct() proxy attack may still be viable. Note that there can be other potential issues if someone initializes the implementation contract.

PlamenTSV commented 3 months ago

PoC

0xmahdirostami commented 3 months ago

no issue here, but yes, security best practice says that it would be to call _disableInitializers in the constructor.