Project

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

Missing validation allows setting maximum tier capacity below already minted tokens

Description

Let's take a look at updateDAOMembership function:

// Preserve minted values and adjust the length of dao.tiers
for (uint256 i = 0; i < tierConfigs.length; i++) {
if (i < dao.tiers.length) {
tierConfigs[i].minted = dao.tiers[i].minted;
}
}

The problem is that this function doesn't verify if the new tier configurations' amount values are greater than or equal to the existing minted values. This could end up in to a situation where:

  1. A tier already has some tokens minted

  2. The DAO admin updates the tier configuration with a new amount that's less than the number of minted tokens

  3. updateDAOMembership will allow this update, creating an invalid state where there are more minted tokens than the maximum allowed amount

Let's say we have a DAO with the following initial tier configuration:

Tier 0: { amount: 100, minted: 50, price: 1000 }
Tier 1: { amount: 50, minted: 20, price: 2000 }

Now, if someone calls updateDAOMembership with new tier configurations:

Tier 0: { amount: 30, price: 1500 } // Problem: amount (30) < minted (50)
Tier 1: { amount: 40, price: 2500 }

updateDAOMembership would allow this update, creating an invalid state where Tier 0 has 50 tokens minted but only allows 30 total. This breaks the fundamental invariant that minted <= amount

Recommendation

Consider to add a validation check before updating the tiers:

// Preserve minted values and adjust the length of dao.tiers
for (uint256 i = 0; i < tierConfigs.length; i++) {
if (i < dao.tiers.length) {
tierConfigs[i].minted = dao.tiers[i].minted;
+ require(tierConfigs[i].amount >= tierConfigs[i].minted, "New amount must be >= minted tokens");
}
}
Updates

Lead Judging Commences

0xbrivan2 Lead Judge
about 1 year ago
0xbrivan2 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!