Hawk High

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

Missing proxiableUUID function in LevelTwo prevents upgrade

Description:

The LevelTwo contract does not inherit UUPSUpgradeable and does not implement the proxiableUUID() function required by the UUPS pattern. This function is essential for the upgrade process as it serves as a compatibility check to ensure the new implementation adheres to the UUPS standard. In the OpenZeppelin implementation, the _upgradeToAndCallUUPS function attempts to call proxiableUUID() on the new implementation contract and expects it to return ERC1967Utils.IMPLEMENTATION_SLOT.

function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
revert UUPSUnsupportedProxiableUUID(slot);
}
ERC1967Utils.upgradeToAndCall(newImplementation, data);
} catch {
// The implementation is not UUPS
revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
}
}

Attack path:

  1. The principal calls graduateAndUpgrade with the address of LevelTwo as the target implementation

  2. If the function were correctly implemented to call upgradeToAndCall instead of just _authorizeUpgrade, the upgrade process would begin

  3. During the upgrade, _upgradeToAndCallUUPS would attempt to call proxiableUUID() on the LevelTwo contract

  4. Since LevelTwo does not implement this function (and does not inherit UUPSUpgradeable where is function included), the call would fail and enter the catch block

  5. The transaction would revert with an ERC1967InvalidImplementation error

  6. The upgrade would fail, leaving the system stuck at LevelOne

Recommended Mitigation:

Implement the proxiableUUID() function in LevelTwo

Updates

Lead Judging Commences

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