updateCountMartenitsaTokensOwner
function lags necessary access control to only allow MarketPlace contract to update the one's holding count of MartenitsaToken, which allows anyone to update others holding count of Martenitsa Token and will also allow producers to not be able to sell their Martenitsa Token under the scenario when the countMartenitsaTokensOwner
is dropped down to 0.
The vulnerability is present in the MartenitsaToken::updateCountMartenitsaTokensOwner
function as it lags necessary access control check on it thus allowing anyone to update countMartenitsaTokensOwner
.
The function takes in the owner for which to either increment or decrement the count of martenitsa token count, and as it lags the access control on it anyone can call it and update other's token counts.
Incorrect result by function MartenitsaToken::getCountMartenitsaTokensOwner
.
By calling the function updateCountMartenitsaTokensOwner
for a producer who has their listing in the marketplace, the attacker will be able to bring the count of their token holding to 0, thus making it impossible for the producer to sell their MartenitsaToken as when a user buys a NFT, the marketplace will be decreasing the count of the producer's token and as their token count of manipulated to 0, the operation will revert. Thus producer will face difficulty in selling their token and for the user to buy the producer's token.
MartenitsaMarketplace::collectReward
uses Martenitsa::getCountMartenitsaTokensOwner
to query for the total count of token a address owns. As countMartenitsaTokensOwner
can be updated by anyone, the collectReward
function will get incorrect output, thus allows anyone to mint unlimited health token.
Add the test in the file: test/MartenitsaMarketplace.t.sol
.
Run the test:
Manual Review, Foundry Unit Test
Add an access control to only allow MartenitsaMarketplace contract to update countMartenitsaTokensOwner
by calling updateCountMartenitsaTokensOwner
.
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.