Project

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

Failure to Adjust Minted Count During Tier Upgrades in MembershipFactory Contract

Summary

The MembershipFactory contract allows users to upgrade their membership tiers. However, during the upgrade process, the minted count for the lower tier is not adjusted, leading to a situation where the total number of tokens minted in that tier does not reflect the actual number of tokens held. This oversight can result in a lack of available slots for new members in the lower tier, potentially causing issues with tier management

Vulnerability Details

In the upgradeTier function, the logic for burning the lower tier token and minting a new token in the higher tier does not update the minted count for the lower tier. The relevant code is as follows:

IMembershipERC1155(daoMembershipAddress).burn(_msgSender(), fromTierIndex, 2);
IMembershipERC1155(daoMembershipAddress).mint(_msgSender(), fromTierIndex - 1, 1);

While the user burns their token from the lower tier and mints a new token in the higher tier, the minted count for the lower tier remains unchanged. This means that the previously minted count does not reflect the actual number of tokens still in circulation, leading to potential issues when new users attempt to join the DAO.

Example of Impact:

  1. A DAO has a limit of 10 tokens for Tier 2, and currently, there are 10 tokens minted.

  2. A user in Tier 3 decides to upgrade to Tier 2.

  3. The user burns their Tier 3 token and mints a new Tier 2 token.

  4. The minted count for Tier 2 remains at 10, even though one token has been effectively removed from circulation.

  5. As a result, the DAO now has 11 tokens minted in Tier 2, exceeding the limit and preventing new users from joining that tier.

Impact

  • Overcrowding of a specific tier, which undermines the purpose of having tier limits.

  • Imbalance in voting power and privileges associated with each tier, as the intended exclusivity of higher tiers is compromised.

Tools Used

  • Manual code review

Recommendations

  1. Adjust Minted Count:

function upgradeTier(address daoMembershipAddress, uint256 fromTierIndex) external {
require(daos\[daoMembershipAddress].daoType == DAOType.SPONSORED, "Upgrade not allowed.");
require(daos\[daoMembershipAddress].noOfTiers >= fromTierIndex + 1, "No higher tier available.");
// Burn the token from the current tier
IMembershipERC1155(daoMembershipAddress).burn(\_msgSender(), fromTierIndex, 2);
// Adjust the minted count for the lower tier
daos\[daoMembershipAddress].tiers\[fromTierIndex].minted -= 1; // Decrement the minted count for the lower tier
// Mint a new token in the upgraded tier
IMembershipERC1155(daoMembershipAddress).mint(\_msgSender(), fromTierIndex - 1, 1);
// Adjust the minted count for the upgraded tier
daos\[daoMembershipAddress].tiers\[fromTierIndex - 1].minted += 1; // Increment the minted count for the upgraded tier
emit UserJoinedDAO(\_msgSender(), daoMembershipAddress, fromTierIndex - 1);
Updates

Lead Judging Commences

0xbrivan2 Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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