The abortBidTaker allows the takers to get compensation in case the offer is cancelled, and allocate the exact amount of token to the taker via TokenManager.
It calculates the amount the taker deposited which was sent to the offer's authority and the same will be allocated to the taker as compensation.
But the formula used to calculate the depositAmount in PreMarkets::abortBidTaker, and will lead to incorrect token amount allocated leading to lost accounting in CapitalPool and TokenManager.
The vulnerability is present in the PreMarkets::abortBidTaker function at line 671, where it incorrectly calculates the depositAmount as follows:
Here, the stockInfo.points represent the token that they taker is buying, preOfferInfo.points represents the total points put as offer by maker and preOfferInfo.amount represents the total amount of token set by maker to exchange the whole points.
And it incorrectly calculate it as:
But correct calculation for the amount the taker deposited will be:
Incorrect refund amount will be allocated to the taker in the mapping of TokenManager, and it will lead to incorrect accounting of token in CapitalPool and TokenManager.
Manual Review
Correct the calculation as:
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.