The function `collectUsdcFromSelling()` allows a seller to withdraw both the sale proceeds and the collateral locked during minting.
However, the contract does not reset the collateral after it is withdrawn.
Specifically, the mapping `collateralForMinting[tokenId]` is never set to zero after being transferred to the seller.
This allows the same collateral amount to be repeatedly included in future withdrawals.
A malicious seller can repeatedly call collectUsdcFromSelling() and receive the same collateral amount multiple times.
This results in:
Repeated extraction of locked collateral
Loss of funds from the contract
Incorrect accounting of collateral
When sufficient balance exists in the contract, this can lead to significant fund loss.
Likelihood:
Reason 1 - The function is callable by the seller without any restriction on the number of times it can be executed.
Reason 2 - No state is updated to prevent reuse of collateral, making exploitation trivial.
Impact:
Impact 1 - A malicious seller can repeated extraction of locked collateral.
Impact 2 - Loss of funds from the contract.
Explanation
This process can be repeated to extract collateral multiple times.
Explanation:
The fix ensures that collateral is only used once by resetting `collateralForMinting[tokenId]` to zero before transferring funds.
This follows the Checks-Effects-Interactions pattern and prevents repeated extraction of the same collateral in subsequent calls.
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.