NFTDeal.sol currently doesn't have the ability to differentiate between SOLD or CANCELED listings. The collectUsdcFromSelling() method simply relies on checking !listing.isActive to decide whether sellers are entitled for withdrawing payment from NFT sales.
Likelihood:
Sellers may simply cancel an active listing to pass the !listing.isActive check.
Impact:
As a result, the seller could just call the collectUsdcFromSelling() method as much as it could to drain the contract's USDC balance.
Replace listing.isActive field with listing.status enum.
ListingStatus State Transitions:ListingStatus is at UNLISTED by default.
list(): UNLISTED -> ACTIVE
buy(): ACTIVE -> SOLD (must check listing.status == ListingStatus.ACTIVE)
cancelListing(): ACTIVE -> UNLISTED
collectUsdcFromSelling() must check listing.status == ListingStatus.SOLD. At the end of this method, it must also set both collateralForMinting and listing.price to 0. Or, simply delete s_listings[_listingId].
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.