Hawk High

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

`LevelTwo` does not inherit from `UUPSUpgradeable` and cannot be used as a new implementation

Description:

The LevelTwo contract, intended as the system's new implementation via the UUPS pattern, does not inherit from UUPSUpgradeable and therefore does not implement the mandatory _authorizeUpgrade(address) function. This causes any call to _upgradeToAndCall() to automatically revert when attempting to update the proxy.

The graduateAndUpgrade() function in LevelOne, responsible for performing the upgrade, will completely fail when trying to execute _authorizeUpgrade() on an implementation that does not define it. The entire transaction reverts, and no state changes occur.

Impact:

  • The upgrade cannot be completed while LevelTwo is incompatible with the UUPS pattern.

  • The graduateAndUpgrade() function completely reverts, and as a result:

    • Teachers do not receive their share of the bursary.

    • The principal cannot collect their portion either.

  • The system remains stuck in LevelOne, with no possibility of migration.

  • While there is no loss of funds, there is an economic denial of service for the contract's internal roles.

  • A new compatible implementation or modification of the upgrade process will be required.

Proof of Concept:

The principal attempts to update the contract's implementation to LevelTwo via the graduateAndUpgrade() function.

bytes memory data = abi.encodeWithSignature("graduate()");
LevelOne(proxy).graduateAndUpgrade(address(levelTwo), data);

The transaction reverts:

│ ├─ [5855] LevelOne::graduateAndUpgrade(LevelTwo: [0x83a4207Df92bA7f9DeD23D61A8802172740D7077], 0xd3618cca) [delegatecall]
│ │ ├─ [224] LevelTwo::proxiableUUID() [staticcall]
│ │ │ └─ ← [Revert] EvmError: Revert
@> │ │ └─ ← [Revert] ERC1967InvalidImplementation(0x83a4207Df92bA7f9DeD23D61A8802172740D7077)

Recommende Mitigation:

Make LevelTwo inherit from UUPSUpgradeable and implement _authorizeUpgrade():

- contract LevelTwo is Initializable {
+ contract LevelTwo is Initializable UUPSUpgradeable {
+ function _authorizeUpgrade(address newImplementation) internal override onlyPrincipal {}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 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.