When creating DAOs, the creator specifies the maximum number of tokens that can be minted for each tier. This number is compared to the total number of tokens minted when joining the DAO to ensure that members don't exceed this amount. The problem lies when a member is upgrading their token tier. The amount is not compared to the amount minted, which will lead to tiers having more tokens than what was designed.
The joinDAO function, ensures that the total tokens minted don't exceed the total supply specified for a token tier and increases the amount of tokens minted for that tier.
https://github.com/Cyfrin/2024-11-one-world/blob/main/contracts/dao/MembershipFactory.sol#L140
The issue lies with the UpgradeTier function, this function burns two tokens from the current tier and mints a new token in the next tier, the problem here is that the maximum amount for the minted tier is not checked, so the token minted can exceed the initial amount set for that tier.
https://github.com/Cyfrin/2024-11-one-world/blob/main/contracts/dao/MembershipFactory.sol#L155
For example, the maximum amount set for Tier 3 is 10, and 10 tokens have been minted for Tier 3.
Let's say Alice calls joinDAOwith a tierIndex of 3 this call will revert because it is currently full.
Alice can bypass this maximum number by minting two tokens on Tier 4 and then upgrading to Tier 3.
This will increase the total amount of tokens on tier 3 to 11, thereby exceeding the maximum amount which is 10.
Tiers will have more than the specified members which is not the intended design
Manual Analysis
This simple fix below will do;
This line require(daos[daoMembershipAddress].tiers[fromTierIndex - 1].amount > daos[daoMembershipAddress].tiers[fromTierIndex - 1].minted, "Tier full."); ensures that the intended tier is not full.
The line daos[daoMembershipAddress].tiers[fromTierIndex - 1].minted += 1; increases the amount minted for the new Tier and daos[daoMembershipAddress].tiers[fromTierIndex].minted -= 2, reduces the amount burned on the current Tier.
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.