When a BID offer maker settles their offer with a partial amount, they receive an excessive amount of collateral refund, so they can drain the pool.
This is similar to another issue: BID makers can drain the pool as they are wrongly refunded on a full settlement
, but the scenario here is a partial settlement; these issues have a different root cause and mitigation.
Alice creates a BID offer for 1000 points and 2000 collateral (initial state: 0 points and 2000 collateral)
Bob creates an ASK order to buy 400 points
Alice settles 300 points on Bob's order (instead of 400), and she pays the full amount (800 collateral)
Bob gets 800 collateral, 100 points stay in the pool
Alice now has: 300 points and 2000 collateral (but she should have 300 points and 1200 collateral instead)
Poc, run forge test --via-ir --match-test test_h12_bid_offer_taker_gets_too_much_refund -vv
Impact: High (Users receive an excessive refund, so they extract value from the protocol)
Likelihood: High (Bid makers have to sacrifice only 1 point out of the total amount)
Risk: Critical
Manual review
In DeliveryPlace
change settleAskTaker
and remove the partial settlement refund logic (it's already handled in closeBidOffer
, you are refunding twice):
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L407-L414
Valid high severity, In `settleAskTaker/closeBidTaker`, by assigning collateral token to user balance instead of point token, if collateral token is worth more than point, this can cause stealing of other users collateral tokens within the CapitalPool contract, If the opposite occurs, user loses funds based on the points they are supposed to receive
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.