collectUsdcFromSelling function does not reset collateral after payout thus allowing an attacker to repeatedly drain the contractWhen an NFT is sold on the marketplace, the seller is supposed to receive the sale proceeds minus protocol fees, along with the USDC collateral they deposited during minting. This payout should occur once per sale, ensuring the contract retains the correct balance and the seller cannot withdraw more than they are entitled to.
The collectUsdcFromSelling() function does not reset or mark the collateral as claimed after paying the seller. As a result, the seller can call the function multiple times and repeatedly withdraw the same collateral along with the sale proceeds, effectively allowing them to drain the contract.
Likelihood:
This will occur when the seller calls collectUsdcFromSelling() after their NFT has been sold, since the function does not mark the collateral as claimed.
This will also occur when the seller repeatedly calls the function for the same listing, allowing them to withdraw the collateral and sale proceeds multiple times.
Impact:
The seller can repeatedly withdraw collateral and sale proceeds, potentially draining the contract of all USDC held for other users.
Other users may be unable to retrieve their funds or participate in sales because the contract’s balance is depleted.
Exploitation of this bug undermines confidence in the NFT marketplace, potentially harming adoption and credibility.
In the NFTDealersTest.t.sol file, add this 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.