Open hats-bug-reporter[bot] opened 1 year ago
I don't think the recommendation given here is valid, since the protocol doesn't seem to be utilizing proxy-implementation architecture. In this case calling _disableInitializers()
in the constructor will prevent the contract from being initialized.
About the contract initialization front-run, the issue is duplicated here, and it's explained why cannot be front-runned due the OZ scripts deploys and initialize the proxies in the same transaction https://github.com/hats-finance/Smooth-0x64bc275b37e62eec81a00ecaecd2b9567058f990/issues/21
About the recommendation, since this is not an UUPS proxy, adding this constructor would not add any security to the current system. Anyway i will consult with the team if we add it as a best practices, if that's the case this issue should be informational/recommendation but i would not labeled as a "bug" since it's not exploitable and it does not add any security adding this code.
We end up deciding to not add this recommendation, since we are using transparent proxies and it's not necessary ^^
Github username: @0xfuje Submission hash (on-chain): 0x2b440f1884c88f8ca016bc058bc3cf6d07f58a0152b675f34384192a5c9f3b66 Severity: medium
Description:
Impact
Contract have to be redeployed with a fix. Funds can be lost if an attacker's initialization remains undetected
Description
DappnodeSmoothingPool
implements openzeppelin's upgradeable model. The problem is that it's unprotected from an attacker initializing the contract. The uninitialized contract can be taken over by the attacker for example by front-running the original deployerintialize()
call. This applies to both the proxy and its implementation contract.From openzeppelin's documentation:
DappNodeSmoothingPool.sol
-initialize()
Recommended Mitigation
Invoke
_disableInitializers()
in the constructor of the contract to prevent the implementation contract from being abused by an attacker. In the future always make sure to call_disableInitializers()
in the constructor of any upgradeable contracts.More information about upgradeable contracts is in: openzeppelin's docs