BID makers have a higher balance than before their offer is settled, so they extract free funds from the protocol.
I highly suggest reading my previous issues before this one to have a better grasp of the context, because the logic is completely faulty, and it can be hard to follow.
Bid offer points are taken from the maker instead of the taker
Bid offer points are never paid by the taker
Please note that all three issues have a separate root cause and fix, every single one must be fixed.
Alice creates a BID offer for 1000 points and 2000 collateral
Bob creates an ASK order to sell 400 points (so Alice should pay 800 collateral)
Charlie creates an ASK order to sell 150 points (so Alice should pay 300 collateral)
Alice settles Bob's and Charlie's orders
Alice should have a credit of 500 points, and 900 collateral left
But in reality, she has a credit of 550 points and 2000 collateral left (900 refunds + 1100 cash)
Alice withdraws and she now has 1550 points and 2000 collateral, but she should have 1550 points and 900 collateral instead
Poc, run forge test --via-ir --match-test test_h9_bid_offer_steals_collateral -vv
:
Impact: High (Loss of funds, the capital pool can be drained)
Likelihood: High (No preconditions)
Risk: Critical
Manual review
In DeliveryPlace
, change settleAskMaker
to avoid refunding the bid maker, as they were refunded already:
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L401-L406
Valid high severity, when taker offers are created pointing to a `offer`, the relevant `stockInfoMap` offers are created with the owner of the offer aka `authority`, set as the creater of the offer, as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L245). Because of the wrong check within settleAskTaker, it will permanently DoS the final settlement functionality for taker offers for the maker that listed the original offer, essentially bricking the whole functionality of the market i.e. maker will always get refunded the original collateral, and takers will never be able to transact the original points put up by the maker. This occurs regardless of market mode.
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.