Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

(HIGH) Unprotected Upgrade Function - Unauthorized contract upgrade leading to potential arbitrary code execution

Summary

(HIGH) Unprotected Upgrade Function - Unauthorized contract upgrade leading to potential arbitrary code execution

Vulnerability Details

Affected Asset

https://github.com/CodeHawks-Contests/2025-05-hawk-high/blob/main/src/LevelOne.sol#L314

function _authorizeUpgrade(address newImplementation) internal override onlyPrincipal {}

Impact

The _authorizeUpgrade function, which is supposed to restrict who can upgrade the contract, is empty. This means anyone can upgrade the contract to a malicious implementation, effectively taking control of the contract and any funds it holds. The graduateAndUpgrade function calls _upgradeToAndCall which uses the _authorizeUpgrade function. Because _authorizeUpgrade is empty, it does not prevent anyone from upgrading the contract.

Likelihood of Exploitation: High. The absence of access control on the upgrade function makes the contract extremely vulnerable. An attacker could easily deploy a malicious contract and upgrade the LevelOne contract, leading to complete control.

Tools Used

  1. Manual Review

  2. AI Assistance report writting

Recommendations

  1. Implement Access Control: In the _authorizeUpgrade function, check if the caller is the authorized upgrade administrator.

function _authorizeUpgrade(address newImplementation) internal override onlyPrincipal {
require(msg.sender == getPrincipal(), "Unauthorized");
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

xyizko Submitter
3 months ago
yeahchibyke Lead Judge
3 months ago
yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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