The initialize function in the MembershipERC1155.sol contract assigns the OWP_FACTORY_ROLE to msg.sender upon contract initialization. This causes a critical issue during contract upgrades, as the proxy admin — rather than the MembershipFactory contract — becomes the new msg.sender and subsequently holds the OWP_FACTORY_ROLE. As a result, the MembershipFactory contract loses its ability to call essential functions like mint and burn in the MembershipERC1155 contract. This role misassignment breaks core functionalities, including joinDAO and upgradeTier, which rely on these permissions.
In the MembershipERC1155 contract, the initialize function is responsible for setting the OWP_FACTORY_ROLE role. This function assigns the role to msg.sender, which works correctly during initial deployment since the MembershipFactory contract is the one deploying and initializing the membership instances. However, when the MembershipERC1155 contract is later upgraded through the TransparentUpgradeableProxy controlled by ProxyAdmin, the initialize function is called with ProxyAdmin as msg.sender. Consequently, OWP_FACTORY_ROLE is assigned to ProxyAdmin instead of the MembershipFactory contract, resulting in permission issues for the MembershipFactory.
This permission mismatch prevents the MembershipFactory from executing critical functions such as mint and burn within MembershipERC1155, disrupting essential functionalities like joinDAO and upgradeTier.
Functions which will be blocked due to this in MembershipFactory:
During initial deployment, the MembershipFactory initializes MembershipERC1155 and gains OWP_FACTORY_ROLE, allowing it to call mint and burn as needed.
Upon an upgrade, the initialize function is called by the ProxyAdmin (as msg.sender), which now holds OWP_FACTORY_ROLE.
The MembershipFactory no longer holds OWP_FACTORY_ROLE, preventing it from calling mint and burn in the MembershipERC1155 contract.
This breaks key functionalities in the MembershipFactory contract, including joinDAO and upgradeTier.
This vulnerability disrupts the primary functions of the MembershipFactory contract, rendering it unable to mint and burn tokens in MembershipERC1155. This effectively blocks users from joining DAOs or upgrading membership tiers, severely impacting system functionality.
Manual analysis
To prevent this issue, modify the initialize function in MembershipERC1155 to explicitly assign the OWP_FACTORY_ROLE to the MembershipFactory contract address rather than to msg.sender.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.