The function collectReward
is intended to allow users to mint 1 HealthToken for every 3 different
MartenitsaTokens they held.
Given the fact that the MartenitsaToken::getCountMartenitsaTokensOwner
can be manipulated to return any
desired value, and the collectReward
function doesn't check that the caller actually
owns 3 distinct MartenitsaTokens, this can be exploited to mint an unlimited amount of HealthTokens.
Proof of concept
Attacker calls 3 times the function MartenitsaToken::updateCountMartenitsaTokensOwner()
passing its own account as the target address and the operation "add".
The attacker calls collectReward()
to receive 1 HealthToken.
Repeat 1 and 2 to obtain the desired amount of HealthTokens.
Place the following code in MartenitsaMarketplace.t.sol
.
It's possible to mint an unlimited amount of HealthTokens without actually owning any NFT.
Manual review
It's required to keep track of the tokenIds of each MartenitsaToken held by each users.
In this way, it will be possible to get the token design and make sure the caller of the
collectReward
function actually owns 3 different tokens.
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.