_updateOwnershipInfo
properly updates new owner's ownership of the Kitty, but fails to remove old owner's ownership of it.
Upon transferring a token from one owner to another via safeTransferFrom
, _updateOwnershipInfo
is called to update the contract's internal state to reflect this change. However, due to the lack of logic to remove the token ID from the s_ownerToCatsTokenId
array of the previous owner, the contract's state inaccurately reflects the ownership of the token. This flaw can be exploited by the previous owner to perform actions as if they still possessed the token, including bridging it to another chain, thereby creating a discrepancy in ownership across different platforms and within the ecosystem.
This vulnerability undermines the security and integrity of the token ownership model within the KittyConnect
ecosystem. Exploiting this flaw can lead to multiple parties claiming ownership of the same token, resulting in confusion, loss of trust, and potential financial implications for the involved parties.
Foundry
Add the following code to the KittyTest.t.sol
file:
Implement logic within the _updateOwnershipInfo
function to remove the token ID from the previous owner's s_ownerToCatsTokenId
array. This update ensures the contract's state accurately reflects the current ownership of tokens and prevents the previous owner from interacting with tokens they no longer own.
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.