Tadle
allows users to create BID
offers to buy points from sellers. After the market settles, sellers need to settle the sold points to the buyers, otherwise they will lose their collateral. Currently, BID offer sellers are unable to settle their tokens due to invalid msg.sender
validation.
When a seller likes a BID
offer, he/she creates an ASK
stock to sell points, by depositing collateral. If he/she fails to do so the buyer will receive the corresponding collateral. Initially, the trades are only kept internally, where no points are traded until the marketplace
reaches AskSettling
state. When this happens, sellers need to invoke DeliveryPlace::settleAskTaker(...)
on the ASK
stock so that he/she can transfer the settled points to the DeliveryPlace
, which then assigns the points to the buyer. However, DeliveryPlace::settleAskTaker(...)
can only be called by the offer owner, which is the buyer, making it impossible for the seller to settle, thus making him lose his deposited collateral.
The below PoC shows how the exploit can occur. I have fixed the PreMarkets.sol
contract name as it was PreMarktes
. It can be run by adding the snippets in PreMarkets.t.sol
and running forge test --mt testSellerCantSettleBidOffer -vv
. I am using the following setup for the tests:
Sellers can't settle BID offers, leading to loss of collateral.
Manual review
Change the msg.sender
validation in DeliveryPlace::settleAskTaker(...)
to check for stockInfo.authority
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.