If a dao is created with n
tiers and it is later being updated to have tiers less than n
then user data will be lost
The MembershipFactory::updateDAOMembership function, lets EXTERNAL_CALLER
upgrade the tier configuration of a DAO.
Let us suppose a DAO is created with name DAO_One
having 6 tiers 0 to 5 using the MembershipFactory::createNewDAOMembership function.
And 20 users join spread across different tiers of the DAO.
Now EXTERNAL_CALLER
calls updateDAOMembership
function and updates the configuration of DAO_One
to now have 3 tiers. Anyone with the EXTERNAL_CALLER
role can do that and there is no mechanism in the updateDAOMembership
function to prevent that from happening.
This can lead to the following issues:
If we see at the updateDAOMembership
function it deletes the tiers
and completely updates the DAO according to the new configuration.
delete dao.tiers;
If we consider the above mentioned assumptions, and the tiers in the dao is reduced then there is no mechanism present to retrieve the users who were already present in the tiers earlier. If there were 6 tiers earlier and now it's 3 then 3 tiers are being deleted, there is no way to retrieve or track the users who were in the tiers which got deleted.
It raises another concern too, even if there was a mechanism to track and re-distribute the users who joined in the tiers which are about to get deleted, it will be against the will of the user. If a user has chosen a particular tier they should remain until they want to change.
It gives unilateral authority to anyone with the EXTERNAL_CALLER
role to just do whatever they want with a particular DAO. Even if the role is trusted someone can just do it by mistake at the cost of user data. If we consider that certain functionality is required to update the dao configuration in future it should be solely given to the creator of the DAO.
I have used foundry for writing the test, it is being installed using forge init --force
we use the --force
flag because it is a non-empty directory. The following test file MembershipFactoryTest
includes the setup and the test function
In the test we first try to make a dao with 6 tiers and join 10 users across different tiers. Then we update the dao with a new tier configuration having 3 tiers.
We run the test by forge test --mt testupdateDAOMembership -vvv
we get this as the output :
We can see that tiers reduced successfully with anyone having the EXTERNAL_CALLER
role. There is no mechanism or check to prevent reducing the number of tiers which can hamper the users.
Users data will be effected and it can lead to unexpected behavior of the protocol
Anyone with EXTERNAL_CALLER
role can unilaterally update the DAO configuration whenever they want.
Likelihood: high, Impact: high but this is an access control bug hence I am keeping severity as medium.
Manual review
Have a check so that tiers can only be increased and not decreased
The way current updating works can hamper the users, in case of dire need only the creator of the DAO should be able to make the necessary changes.
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.