Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Missing UUPS Inheritance in LevelTwo

Description: LevelTwo imports only 'Initializable' and lacks 'UUPSUpgradeable' inheritance and __UUPSUpgradeable_init()

Impact: The intended UUPS proxy pattern is broken: no '_authorizeUpgrade' hook is available, and the proxy cannot be safely upgraded to a next implementation if needed.

Proof of Concept:

Note: this PoC assumes that the 'Misused UUPS Upgrade Flow' issue has already been fixed, so that graduateAndUpgrade gets as far as splitting by totalTeachers instead of reverting earlier.

- function graduateAndUpgrade(address _levelTwo, bytes memory) public onlyPrincipal {
+ function graduateAndUpgrade(address _levelTwo, bytes memory data) public onlyPrincipal {
- _authorizeUpgrade(_levelTwo);
+ upgradeToAndCall(_levelTwo, data);
}

After this fix include the following test in the LevelOneAndGraduateTest.t.sol file:

function testCantUpgrade() public schoolInSession {
levelTwoImplementation = new LevelTwo();
levelTwoImplementationAddress = address(levelTwoImplementation);
vm.startPrank(principal);
vm.expectRevert();
levelOneProxy.graduateAndUpgrade(levelTwoImplementationAddress, "");
vm.stopPrank();
}

Attempting to compile or upgrade the proxy to LevelTwo will fail due to missing functions.

Recommended Mitigation:

+ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
- contract LevelTwo is Initializable {
+ contract LevelTwo is Initializable, UUPSUpgradeable {
+ constructor() { _disableInitializers(); }
+ function _authorizeUpgrade(address newImplementation) internal override onlyPrincipal {}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

failed upgrade

The system doesn't implement UUPS properly.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.