KittyConnect
connect implements a enumerable system to keep track of the amount of kitties owned by addresses, but state variables are updated incorrectly after the ownership of a kitty is transferred, that leads to give the impression that one kitty is owned by multiple accounts.
KittyConnect::_updateOwnershipInfo
updates the ownership info of a kitty after the transfer of the token, the function correctly handles correctly the info of the new owner, but does not update the info of the previous owner.
The flow of the bug can be explained in the following steps:
Shop partner mints kitty to user
User approves new owner to transfer ownership
Shop partner transfers kitty from user to new owner
If we query KittyConnect::getCatsTokenIdOwnedBy
with the address of the previous and new owner, the function will return the same token id.
This is confirmed in the test below.
A kitty can give the impression to be owned by multiple owners.
Manual review.
Keeping track and updating an enumerable after each transfer of ownership can be a difficult algorithm to to design. I recommend implementing a battle tested library like ERC721Enumerable
from OpenZeppelin to track the amount of kitties owned by accounts.
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.