The MartenitsaToken::updateCountMartenitsaTokensOwner
function is set to external
visibility with no checks or access controls which allows any user to modify the MartenitsaToken count of anyone and can impact protocol in multiple ways.
Malicious user can decrease the count of any user rendering their tokens unsellable or making them unable to makeprenents using MartenitsaMarketplace::makePresent
.
Malicious user can call MartenitsaToken::updateCountMartenitsaTokensOwner
multiple times make MartenitsaToken::getCountMartenitsaTokensOwner
return any value he wishes rendering any functions depending on it vulnerable.
Malicious user can increase his tokens count and call MartenitsaMarketplace::collectReward
to steal healthtokens for free and using which he can call MartenitsaEvent::joinEvent
to join the event.
The MartenitsaEvent::stopEvent
runs a loop through participants.length
, since a Malicious user can join the event he can increase the length of MartenitsaEvent::participants
array making the owner spend a lot of gas.
Note: Please Import {console}
in MartenitsaToken.t.sol
by adding import {console} from "forge-std/Test.sol";
at the top for the PoC's to work effortlessly
Add the Poc's below to MartenitsaToken.t.sol
and run those tests.
Malicious user can Decrease any ones count and render their listed tokens unsellable
Malicious user can make MartenitsaToken::getCountMartenitsaTokensOwner
return any value he wishes by calling MartenitsaToken::updateCountMartenitsaTokensOwner
multiple times.
Malicious user can increase his tokens count and call MartenitsaMarketplace::collectReward
to steal healthtokens for free and using which he can call MartenitsaEvent::joinEvent
to join the event.
Malicious user can Join Event using various addresses by calling MartenitsaEvent::joinEvent
as stated above which increases the MartenitsaEvent::participants
array length significantly increasing the Gas spent by the owner .
The Code below consumes gas as stated below :
extraUsers = 5
gas consumed is 5792
extraUsers = 25
gas consumed is 22732
extraUsers = 50
gas consumed is 43907
increase extraUsers
variable below increase the gas cost
In MartenitsaToken.sol
import MartenitsaMarketplace
import {MartenitsaMarketplace} from "./MartenitsaMarketplace.sol";
Add a new state variable for MartenitsaMarketplace
MartenitsaMarketplace private _martenitsaMarketplace;
Declare a new Function MartenitsaToken::setMarketAddress
which can only be accessed by the owner and is used to set marketplace address
Finally, Add a require statement as the firstline in MartenitsaToken::updateCountMartenitsaTokensOwner
function
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.