The MartenitsaMarketplace::collectReward function allows non-producer users to collect Health Token on the basis of their holding of their MartenitsaToken. But when a user collects their health tokens, the total collected Health Token rewards of the user is updated to current claimed health tokens instead of incrementing it by that claimed amount, thus a user can claim more health tokens due to this lost accountability of claimed Health Tokens.
The vulnerability is present in the MartenitsaMarketplace::collectReward function, when a user claims x amount of health token then the function incorrectly updates the total claimed health token reward of the user to x, thus allowing the user to claim a large amount of Health Tokens, as the current claimed health reward will show lesser amount of health token claimed then the actual claimed amount.
A user can claim larger amount of health tokens.
For example:
A user has 3 Martenitsa Token, therefore they are eligible to collect 1 Health Token, after claiming _collectedRewards becomes equal to 1.
After some time user gets 3 more Martenitsa Token, total = 6, now claimable health token will be (6 / 3) - 1 = 1 Health Token, and _collectedRewards is set to 1.
Again user gets 3 more Martenitsa Token, total = 9, now claimable health token will be (9 / 3) - 1 = 2 Health Token, and _collectedRewards is set to 2.
We can observe that though the user had 9 Martenitsa Token but still they were able to claim 1 + 1 + 2 = 4 Health Token instead of 9 / 3 = 3 Health Token due to lost accounting of the claimed health token.
And as the _collectedRewards is still 2, the user can claim Health Token again and again, as it will be always less than 3 (for 9 Martenitsa Token).
Manual Review
Increment the _collectedRewards by current claimed Health Token amount.
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.