The updateDAOMembership function in the DAO Membership Factory contract has a flaw that could lead to unintended overwriting of the minted field within each tier during updates. This can lead to discrepancies between actual and recorded membership counts for specific tiers, allowing more memberships to be minted than intended, affecting the integrity of DAO membership management.
In the updateDAOMembership function, the code attempts to preserve previously minted values for each tier by copying them from the old dao.tiers data into the tierConfigs array, before deleting and resetting dao.tiers. However, this logic can fail if the length of tierConfigs does not match the original dao.tiers array length, resulting in possible overwriting or loss of the minted data.
Mismatch in Array Length: If the new tierConfigs array has fewer elements than the original dao.tiers, not all minted values are preserved, causing data loss.
Inadvertent Overwriting: For new tiers, the minted field is left at 0, even if previously minted values exist for some of the updated tiers.
This behavior introduces potential discrepancies that could allow the DAO to mint more memberships than intended by resetting minted counts inadvertently.
The following code snippet from updateDAOMembership demonstrates where the minted data might be unintentionally overwritten:
The loop that copies minted values relies on tierConfigs having the same or greater length as dao.tiers.
If tierConfigs is shorter, some minted values are not copied and are lost.
This results in the final dao.tiers having unintended zero minted values, which allows memberships to be over-minted.
Deploy a DAO with an initial minted count for each tier.
Update the DAO’s tier configuration using a shorter tierConfigs array than the original dao.tiers.
Verify that the minted values are reset or incorrectly updated, allowing memberships to be over-minted.
Users can mint additional memberships beyond the intended minted limit.
A DAO’s membership data becomes inaccurate, leading to a misrepresentation of membership status and compromising DAO functionality and integrity.
Manual review.
To prevent overwriting of minted values, add validation to ensure that the updated tierConfigs array length matches the existing dao.tiers length. Additionally, validate each tierConfig to ensure the minted value is preserved accurately before overwriting.
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.