MartenitsaToken::countMartenitsaTokensOwner
is a mapping that keeps tracks of the number of Martenitsa owned by accounts, this state variable is correctly updated when a token is created and when a token is sold, but when an owner transfer the token
to a new account the state variable is not updated resulting in the previous account is owning the token.
If a user calls the MartenitsaToken::transferFrom
and MartenitsaToken::safeTransferFrom
methods to transfer the tokens, MartenitsaToken::countMartenitsaTokensOwner
will still account for the transferred token.
To verify the vulnerability paste the following test in MartenitsaToken.t.sol
:
Invariant broken, protocol still accounts for transferred tokens after owner renounced the ownership.
Manual review, Foundry
Override the transferFrom
and safeTransferFrom
and add logic to update MartenitsaToken::updateCountMartenitsaTokensOwner
counter for the sender and recipient.
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.