The KittyConnect::mintBridgedNFT function aims to mint the token received from the bridge and update the state variables accordingly. However, it currently fails to update the s_ownerToCatsTokenId[catOwner] variable.
The vulnerability lies within the KittyConnect contract, specifically in the mintBridgedNFT function, where state changes for the s_ownerToCatsTokenId variable are not handled.
It is expected that the function would append the new tokenId to s_ownerToCatsTokenId[catOwner], but this action is currently omitted.
Upon receiving a bridged token from the source chain, the tokenId will not be added to s_ownerToCatsTokenId[catOwner], resulting in an inaccurate list of owner token IDs.
Manual review and 'forge'.
To replicate the issue, add the following test suite to the tests file test/KittyConnect.t.sol:
Subsequently, execute this test suite:
This test will fail.
Integrate the following changes into the mintBridgedNFT function:
These modifications ensure that mintBridgedNFT correctly updates the s_ownerToCatsTokenId[catOwner] variable, thereby resolving the identified vulnerability.
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.