The joinDAO
function in the provided Solidity code contains a logical error in the validation of the tierIndex
. The current logic incorrectly checks if the tierIndex
is valid, which could lead to potential issues in the contract’s functionality.
https://github.com/Cyfrin/2024-11-one-world/blob/main/contracts/dao/MembershipFactory.sol#L140-150
The vulnerability lies in the following line of code:
This line checks if the tierIndex
is less than the total number of tiers (noOfTiers
). However, this logic is flawed because it does not account for the possibility of tierIndex
being equal to the highest unit of tier index, which in such a scenario would be equal
This could result in users being able to join existent tiers, causing inconsistencies in the DAO membership data and Dos for incoming users
manual review
To fix the issue, the validation logic should be updated to ensure that tierIndex
is within the valid range of existing tiers. The correct equality sign should be greater than or equals to
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.