The current implementation of the abortOfferStatus update(in listOfferfunction) for originOfferInfo contains critical issues. The status is incorrectly updated in memory instead of storage.
The abortOfferStatus is being updated in memory instead of storage, leading to the update not being persisted. This results in the status not reflecting the actual state of the offer after the function execution.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L335-L343
Add the following POC in PreMarkets.t.sol:
Due to above issue as it is not updating the storage, the turbosettlementType offers which will have subOfferlisted can also be aborted by calling abortAskMaker. This will cause loss of funds for the protocol since in turbomode, subOffers are not collateralized and due to abortof offer, they will get the collateral.
Consider following scenario to understand the impact:
Maker M1listed 100 points for 100 USDCin turbo mode
Taker T1bought 100 points for 100 USDCfrom M1
Taker T1listed the 100 points for 200 USDC
Buyer B1bought 100 points for 200 USDCfrom T1.
If M1calls abortAskOfferand aborts the offer and take the collateral back, who will settle the stockof Buyer B1.
Manual review
Fixed code:
Valid high severity, because the `abortOfferStatus` of the offer is not updated and persist through `storage` when listing an offer for turbo mode within the `offerInfoMap` mapping, it allows premature abortion given the `abortOfferStatus` defaults to `Initialized`, allowing the bypass of this [check](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L552-L557) here and allow complete refund of initial collateral + stealing of trade tax which can potentially be gamed for profits using multiple addresses
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.