ProtocolDAO contract cannot be updated #729
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
duplicate-742
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
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-12-gogopool/blob/main/contracts/contract/ProtocolDAO.sol#L209
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/Storage.sol#L29
Vulnerability details
Impact
The protocol has chosen a data separation upgrade mechanism which means that all the data is located in a smart contract not upgradable and the logic in upgradeable contracts. The
ProtocolDAO
contract which is part of the upgradable ones via the storage registration technique (as per documentation) is actually not upgradeable.The impact is that the
ProtocolDAO
contract cannot be updated which means that, if any logic is added to the smart contract, the protocol will be stuck with it.Proof of Concept
The modifier
onlyRegisteredNetworkContract
is limiting the execution of setting and deleting keys inStorage.sol
.Practically when updating the
ProtocolDAO
, theProtocolDAO
contract is unregistered which means that the following keykeccak256(abi.encodePacked("contract.exists", addr))
) is deleted and will revert when deleting the address due to the condition check on the key in the modifier.To reproduce it, add this method in the
ProtocolDAO.t.sol
and run the test by using:Tools Used
Visual Studio Code, Unit tests (Foundry)
Recommended Mitigation Steps
By removing the boolean existence at the end, we are allowing the deletion of the address and the name of the contract without triggering the exception from
onlyRegisteredNetworkContract
.The text was updated successfully, but these errors were encountered: