The LevelOne.sol contract uses the Universal Upgradeable Proxy Standard (UUPS) to allow future upgrades to the smart contract. However, it was not possible to confirm that the _authorizeUpgrade(address) function is implemented with the appropriate restrictions.
Risk: Without the _authorizeUpgrade() function implemented and restricted to an administrative role (e.g. onlyPrincipal), any user can override the contract logic with malicious logic, taking full control of the funds and functionality
pragma solidity 0.8.26;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract LevelOne is Initializable, UUPSUpgradeable {
address public principal;
function initialize() public {
principal = msg.sender;
}
function _authorizeUpgrade(address newImplementation) internal override {
}
}
pragma solidity 0.8.26;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract LevelOne is Initializable, UUPSUpgradeable {
address public principal;
function initialize() public initializer {
principal = msg.sender;
}
modifier onlyPrincipal() {
require(msg.sender == principal, "LevelOne: caller is not principal");
_;
}
function _authorizeUpgrade(address newImplementation)
internal
override
onlyPrincipal
{}
}