An error in the formula used to calculate depositAmount
within the PreMarkets::abortBidTaker
function leads to an incorrect recording of the depositAmount
. This discrepancy can result in Bid Takers being refunded an incorrect amount of tokens, which differs from what they initially deposited.
The vulnerability is found in the PreMarkets::abortBidTaker
function, specifically in the calculation of the depositAmount
. The current formula is incorrectly arranged, causing an inaccurate computation. Below is the problematic code:
Incorrect Formula:
The current formula is:
This formula is incorrect because it does not properly calculate the proportional deposit amount based on the points and amount.
Correct Formula:
The correct formula should be:
This corrects the order of operations, ensuring that the depositAmount
is proportional to the points and amount as originally intended.
The incorrect formula leads to a situation where the Bid Taker is refunded an incorrect amount of tokens, which can differ significantly from their original deposit.
This discrepancy is evident when compared to the correct formula used elsewhere in the code, specifically in the PreMarkets::createTaker
function, which calculates the depositAmount
correctly.
Due to the incorrect formula, the protocol miscalculates the depositAmount
, resulting in incorrect refunds to Bid Takers. This can lead to financial losses or inconsistencies in the protocol's accounting, potentially undermining user trust and the protocol’s integrity.
Manual analysis
The protocol should update the formula in the PreMarkets::abortBidTaker
function to correctly calculate the depositAmount
. The correct formula should be:
This adjustment will ensure that the depositAmount
is accurately recorded and that Bid Takers are refunded the correct amount of tokens.
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.