Open hats-bug-reporter[bot] opened 1 year ago
Duplicated: 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
Github username: @0xDetermination Submission hash (on-chain): 0xdaafb805219e79cfca832079f3497e87547c741602099b0ada8f7ef82bc11d5f Severity: medium
Description:
Impact
An attacker can set the governance address, fee address, and owner address. The contract will need to be redeployed, and the protocol will lose the deployment fees. If the protocol does not notice the attack, then the attacker can steal the contract's funds.
PoC
DappnodeSmoothingPool.sol
does not have a constructor, and there is no access control on the initialize() function. Therefore, anyone can call initialize() to set the governance address, fee recipient address, and owner address.Attack example:
initialize()
initialize()
, setting governance and owner addresses to the attacker's own addresssubmitReport()
and updates the reward root such that the balance of the contract can be transferred to the attacker's addressclaimRewards()
and drains the contractRelevant Code
https://github.com/hats-finance/Smooth-0x64bc275b37e62eec81a00ecaecd2b9567058f990/blob/main/contracts/DappnodeSmoothingPool.sol#L182-L220
Recommended Fix
Call
initialize()
in the constructor, or add access control.