Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: high
Invalid

Intended Upgradeability Not Achieved Due to Missing Upgrade Mechanism in MembershipERC1155 Contract

Summary

The MembershipERC1155 contract is designed to be an upgradeable ERC1155 token for DAO memberships, allowing flexibility in adding new features or modifying the contract logic in future upgrades. However, despite inheriting from OpenZeppelin's upgradeable base contracts and using an initialize function, the contract lacks a necessary upgradeability mechanism, such as the UUPSUpgradeable module or deployment through a proxy. This oversight creates a critical flaw: the contract is deployed as non-upgradeable, preventing updates to its logic once deployed. Consequently, any bugs, security vulnerabilities, or required functional optimizations cannot be addressed without redeploying a new contract, which would require users to migrate manually.

Vulnerability Details

In the MembershipERC1155 contract, several signs suggest an intention for upgradeability, including the use of OpenZeppelin’s upgradeable base contracts like ERC1155Upgradeable and AccessControlUpgradeable, and the initializer modifier in place of a constructor. However, the contract does not inherit from UUPSUpgradeable or any similar upgradeability module, nor is it deployed through a proxy, leaving no means for an upgrade.

Without implementing an actual upgrade pattern, the contract cannot be redeployed with updated logic, thus failing to meet the expected upgradeability functionality. This design flaw could severely impact the protocol's ability to maintain or optimize the contract over time.

Impact

The contract is intended to be upgradeable to facilitate optimizations, bug fixes, or new features. However, this intention is not realized due to the missing upgrade mechanism, breaking a critical protocol assumption that this contract is flexible and upgradable. In its current form, the contract is essentially immutable after deployment, leading to a potential need for redeployment in the event of any issues. This could expose the protocol to significant operational risks, as any critical bugs or vulnerabilities would require the deployment of a new contract and manual user migration, which is both costly and disruptive.

Tools Used

None

Recommendations

To ensure the contract can be upgraded in future, we recommend implementing one of the following steps:

  1. Add UUPSUpgradeable Inheritance: Modify the contract to inherit from UUPSUpgradeable and implement the _authorizeUpgrade function to restrict upgrade authorization. This allows the contract to be upgradeable through a UUPS proxy.

    import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
    contract MembershipERC1155 is ERC1155Upgradeable, AccessControlUpgradeable, UUPSUpgradeable, IMembershipERC1155 {
    // Contract code...
    function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE) {}
    }
  2. Use a Proxy Deployment: Deploy the contract via an upgradeable proxy, ensuring that it can point to a new implementation contract in the future.

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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