The calculations are incorrect due to the use of the wrong denominator when calculating depositAmount, which is later used to calculate the refund amount.
Consider the following code:
The incorrect calculation of depositAmount can be exploited by an attacker. Here is how:
An attacker, as a Maker, creates a Bid offer to buy 1,000,000 Points for 1 unit of USDC (0.000001 USD).
The attacker, as a Taker, accepts the Bid offer, paying 1 unit of USDC.
The Bid offer is aborted to finalize the attack.
The attacker calls PreMarkets.abortBidTaker(), resulting in the following calculations:
As a result, the attacker’s balance is increased by 1 million USDC.
Loss of funds.
Manual review.
Correct the calculation of depositAmount:
Valid high severity, due to incorrect computation of `depositAmount` within `abortBidTaker`, when aborting bid offers created by takers, the collateral refund will be completely wrong for the taker, and depending on the difference between the value of `points` and `amount`, it can possibly even round down to zero, causing definite loss of funds. If not, if points were worth less than the collateral, this could instead be used to drain the CapitalPool contract instead.
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.