PreMarkets.abortBitTaker is a function used by the taker to get a refund of the collateral they deposited for purchasing a certain amount of points in case the corresponding offer is aborted. The problem is that the calculation is not performed correctly, resulting in the taker aborting their bid but not receiving back the initially locked collateral.
Let's first look at how the collateral to be deposited when creating a taker is calculated through createTaker
.
The points the taker wants to purchase are multiplied by the total amount for the entire offer and divided by the total number of points for that offer. The goal is to obtain the portion of the amount that is proportional to the points being purchased when creating this taker. Now, let's examine how the amount of tokens to be refunded to the taker is calculated.
It can be seen that the points in the corresponding stock are multiplied by the points in the offer and divided by the amount. This is almost always 0, and even in cases where it is not 0, the value is quite different from what was paid. As a result, the taker loses their refund. It can be seen in the POC below.
Loss of funds for the taker.
Manual review
Fix the calculation of the deposit amount in abortBidTaker to be same as the one in createTaker.
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.