The lockAmount immutable variable is intended to be a USDC amount locked by users when they mint an NFT. This amount is locked in the contract and tracked with the collateralForMinting(tokenId => lockAmount) mapping. There are 2 ways for a user to get their locked amount back:
By calling cancelListing, he will receive the locked amount of USDC and the collateralForMinting mapping will be set to zero for this unlisted token.
By calling collectUsdcFromSelling, he will receive the locked amount of USDC, but the collateralForMinting mapping will not be updated for the listing's token.
In this finding, we will only talk about the first way to get the tokens back. This issue makes the locked tokens feature completely useless because any user can get the locked tokens back easily.
This can look like a low-impact vulnerability because the default lockAmount is 20 USDC, but on other applications, it can be much higher for specific purposes.
Likelihood:
This will happen whenever a seller wants to get back his locked USDC amount
Impact:
The USDC lock-on-mint feature is not working
Actors:
Seller: A user minting an NFT and getting his locked USDC back by canceling his listing
Proof of Code:
Don't refund the collateral to the seller on listing cancellation. If you want to let users get their locked USDC back if they didn't manage to sell an NFT, it should be done through a custom burn 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.
The contest is complete and the rewards are being distributed.