The _authorizeUpgrade
function, inherited from UUPSUpgradeable
, is called when the contract is upgraded by upgradeToAndCall
(only, as of the version 5.0.0 of OpenZeppelin Contracts).
The documentation clearly states that "Normally, this function will use an access control modifier such as Ownable.onlyOwner."
However, this is not the case here and any malicous actor can then upgrade the implementation contract and implement malicious functions to, for example, drain the proxy contract of its funds.
Malicous actor deploys a malicious version of the implementation with a stealFunds()
function.
Malicous actor calls upgradeToAndCall
with the address of his malicious contract.
Malicous actor calls the mondrianWallet
call
function with the malicious encoded function
Paste the following malicious contract into ModrianWallet2Test.t.sol
:
And paste the following test into ModrianWallet2Test.t::MondrianWallet2Test
:
The protocol can be drained of all its funds
Manual review
Add, as recommended, the modifier onlyOwner to the function _authorizeUpgrade :
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.