Malicious user can settle the askMaker offer using deliveryPlace::settleAskMaker() with 0 or 1 settledPoints, making loss for buyers
Offer owner can call deliveryPlace::settleAskMaker() to settle their askMaker offer by passing amount of settledPoints they want to settle. And based on settledPoints, pointsTokenAmount is calculated and transfered to capitalPool. Also status of the offer is changed to settled
Now the problem is, a malicious user can create ask offer which buyers will buy paying collateralToken. Malicious user will then call deliveryPlace::settleAskMaker() with very less settledPoints as compared to what buyer have bought.
As result, malicious user will be able to settle the offer with very less or zero amount of pointsToken, making a loss for buyer because buyer paid for alot more pointsToken as compared to what they get when they call deliveryPlace::closeBidTaker()
//Here is PoC
Above test shows, how user2 paid collateralToken for 1000 pointsToken but got only 1 pointsToken because malicious user settled the offer only for 1 settlePoints(can also settle for 0 settlePoints). Also once the offer is settled, it can't be called again because the status of the offer is changed to Settled & only virgin or cancelled offer can call deliveryPlace::settleAskMaker().
Also malicious user will be able to withdraw those collateralToken paid by buyer, giving buyer 1 or 0 pointsToken only.
If you thinking about malicious will loss `extra` initialCollateral(which he get when he pass _settledPoints = offerInfo.usedPoints) then you can see malicious user created the offer with only 100% collateralRate, which means he will get all collateralAmount when buyer buy the points, leaving no extra makerRefundAmount to withdraw because collateralRate was only 100% ie 10000
Buyer will loss pointsToken as malicious user can rug pull them
Manual Review
Only allow to settle the offer when _settledPoints = offerInfo.usedPoints because this will allow offer owner to transfer total pointsToken to capitalPool before settling the offer
Valid high, in settleAskTaker/settleAskMaker, if the original offer maker performs a partial final settlement, the existing checks [here](https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L356-L358) and [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L230-L232) will cause an revert when attempting to complete a full settlement, resulting in their collateral being locked and requiring a rescue from the admin. To note, although examples in the documentation implies settlement in a single click, it is not stated that partial settlements are not allowed, so I believe it is a valid user flow.
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.