Project

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

Potential Data Loss in `updateDAOMembership` When Reducing Tier Configurations

Title

Potential Data Loss in updateDAOMembership When Reducing Tier Configurations

Summary

In the updateDAOMembership function, when the new tierConfigs array has fewer entries than the existing dao.tiers, the logic attempts to preserve minted values for the overlapping tiers. However, this approach does not address the potential loss of data for tiers that are removed.

Vulnerability Details

The loop in the updateDAOMembershi function copies minted values from dao.tiers to tierConfigs for indices that exist in both arrays. This ensures that minted values are preserved for tiers that remain.

function updateDAOMembership(string calldata ensName, TierConfig[] memory tierConfigs)
external onlyRole(EXTERNAL_CALLER) returns (address) {
address daoAddress = getENSAddress[ensName];
require(tierConfigs.length <= TIER_MAX, "Invalid tier count.");
require(tierConfigs.length > 0, "Invalid tier count.");
require(daoAddress != address(0), "DAO does not exist.");
DAOConfig storage dao = daos[daoAddress];
if(dao.daoType == DAOType.SPONSORED){
require(tierConfigs.length == TIER_MAX, "Invalid tier count.");
}
uint256 maxMembers = 0;
// 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;
}
}
// Reset and update the tiers array
delete dao.tiers;
for (uint256 i = 0; i < tierConfigs.length; i++) {
dao.tiers.push(tierConfigs[i]);
maxMembers += tierConfigs[i].amount;
}
// updating the ceiling limit acc to new data
if(maxMembers > dao.maxMembers){
dao.maxMembers = maxMembers;
}
dao.noOfTiers = tierConfigs.length;
return daoAddress;
}

Tiers that exist in dao.tiers but not in tierConfigs are effectively removed, along with any associated data, such as minted values or other tier-specific information.
The function does not provide a mechanism to archive or handle data from tiers that are no longer part of the configuration.

Impact

When the updateDAOMembership function adjust tier configurations, it may ignore existing tiers if dao.tiers contains more tiers than tierConfigs. This can result into loss of minted data for extra tiers and also members who acquired tokens in the extra tiers may lose their membership status or benesits, as these tiers are no longer recognized. This discrepancy can cause significant confusion, especially if the users still hold tokens associated with unrecognized tiers.

Tools Used

Manual Review

Recommendations

Implement checks that prevent updates from proceeding if tierConfigs have fewer tiers than dao.tiers (unless explicitly allowed) or notify DAO members if an update will exclude certain tiers so they ca prepare for potential impact.

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!