The DeliveryPlace.settleAskTaker
function is called by the taker who has been matched with a bid maker to provide the necessary tokens to complete the transaction. When this happens, the taker receives their collateral back. The problem is that there is an inconsistency between the amount of collateral that is deposited and the amount that is refunded. The amount refunded during settleAskOffer
is multiplied by the collateralRate
and is therefore larger than the amount deposited in createTaker()
, which is not multiplied by the collateral rate. As a result, the ask taker receives more than they deposited and can drain the tokens locked in the protocol.
I am attaching the two code fragments where the described calculations are made, along with a POC that demonstrates the described scenario.
It is important to also consider the OfferLibraries.getDepositAmount function, as it returns different values depending on the value of the maker flag and the type of offer (bid/ask).
As you can see both values are different as explained in the report. To make this report work it is necessary to fix the issue from one of my other reports named "Broken access control in DeliveryPlace.settleAskTaker() leads to loss of funds".
Loss of funds for the protocol and its users
Manual review
This inconsistency needs to be fixed by either using collateralRate in both cases or not using it in either case.
Valid high, the additional collateral based on collateralRate is not updated to taker balance for protected mode. This results in incorrect collateral refunded to taker during settlement.
Valid high, the additional collateral based on collateralRate is not updated to taker balance for protected mode. This results in incorrect collateral refunded to taker during settlement.
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.