When upgrading UUPS
upgradable contracts, the Proxy contract owner calls upgradeToAndCall()
to change its implementation. And fire the initializing function of the new implementation in his context via delegate call.
When doing this thing in Bridge
, we can see that it takes these variables as the initializing inputs.
As we can see we are taking the owner address as an input when upgrading our Bridge contract to the new implementation, gives him the ownership of the contract, and then sets StarklaneL2Address
and Selector
, and this is the problem.
The problem here is that when calling setStarklaneL2Address
there is a modifier onlyOwner
.
Since we are using UUPS/ERC1967
upgradable proxy standard, we are calling _authorizeUpgrade()
, to authorize the upgrading and we only let the owner to be able to upgrade in our contract (Bridge
). So the msg.sender
will be the owner of the contract.
Since it is allowed to change the owner when upgrading the contract as we illustrated, the upgrading process will end up reverting because of onlyOwner
check when calling setStarklaneL2Address()
as the owner is not the msg.sender
now.
This will end up failing the upgrading process at the last check, which is not actual behavior. Leading to the failure of the upgradability process and the loss money paid as the Gas Cost for deploying.
Failing of the upgradability process.
Lossing the gas cost paid for the upgrading process.
Manual review
Change the ownership in the last of the Bridge::initialize()
function.
No real impact. It even prevents to set an invalid owner. Future versions/upgrades are out-of-scope since this function can/will change to do not modify the owner at every upgrades.
No real impact. It even prevents to set an invalid owner. Future versions/upgrades are out-of-scope since this function can/will change to do not modify the owner at every upgrades.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.