Project

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

Lack of Capacity Check in `upgradeTier` Function Allows Overcapacity in Membership Tiers

Code Links:
https://github.com/Cyfrin/2024-11-one-world/blob/1e872c7ab393c380010a507398d4b4caca1ae32b/contracts/dao/MembershipFactory.sol#L155-L161

Description:

The upgradeTier function in the MembershipFactory contract is designed to allow users to upgrade their membership tier within a sponsored DAO. However, the current implementation contains a critical vulnerability that does not check whether the target tier is filled to its maximum capacity. This oversight can lead to an increase in the number of members in a tier beyond its defined limit, which undermines the integrity of the membership structure.

Vulnerability Details

The function does not include a check to verify if the target tier (the tier the user is upgrading to) has reached its maximum capacity. Each tier is defined to have a maximum number of members, but this constraint is not enforced during the upgrade process.

When a user upgrades their tier, the function burns their current tier membership and mints a new membership for the target tier. If the target tier is already at its maximum capacity, this operation will result in an additional member being added to that tier, violating the defined membership limits.

Impact:

  • Allowing more members than the defined maximum in a tier can lead to several issues:

    • Dilution of Membership: The value and benefits associated with each tier may diminish as more members are added beyond the intended limits.

    • Inequity Among Members: Existing members in the target tier may feel disadvantaged if the tier becomes overcrowded, leading to dissatisfaction and potential governance issues within the DAO.

    • Operational Confusion: The DAO's operational logic may become inconsistent, as the actual number of members in a tier does not align with the expected limits defined in the tier configuration.

Proof of Concept:

Recommended Mitigation:

  1. Updated Function Implementation:

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.");
+ require(daos[daoMembershipAddress].tiers[fromTierIndex - 1].amount > daos[daoMembershipAddress].tiers[fromTierIndex - 1].minted, "Target tier is full.");
IMembershipERC1155(daoMembershipAddress).burn(_msgSender(), fromTierIndex, 2);
IMembershipERC1155(daoMembershipAddress).mint(_msgSender(), fromTierIndex - 1, 1);
emit UserJoinedDAO(_msgSender(), daoMembershipAddress, fromTierIndex - 1);
}
Updates

Lead Judging Commences

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

Support

FAQs

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