AMM Cannot Be initialize()
Except By Governance
#51
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/AMM.sol#L93-L108
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/AMM.sol#L730-L734
https://github.com/code-423n4/2022-02-hubble/blob/main/contracts/legos/Governable.sol#L10-L13
Vulnerability details
Impact
The contact
AMM.sol
cannot be initialize unless it is called from the_governance
address.This prevents the use of a deployer account and requires the governance to be able to deploy proxy contracts and encode the required arguements. If this is not feasible then the contract cannot be deployed.
Proof of Concept
initialize()
calls_setGovernace(_governance);
which will store the governance address.Following this it will call
syncDeps(_registry);
which hasonlyGovernance
modifier. Thus, if themsg.sender
ofinitialize()
is not the same as the parameter_governance
then the initialisation will revert.Recommended Mitigation Steps
Consider adding the steps manually to
initialize()
. i.e.The text was updated successfully, but these errors were encountered: