An Ask Turbo Offer can be aborted even if there is sub offer listed, due to AbortOfferStatus is not updated as expected.
When an ask Turbo offer is filled, the taker can list a sub offer of the origin offer. In that case, the origin offer is not supposed to be aborted.
The offer's AbortOfferStatus is updated when the sub offer is listed:
However, if we pay a close attention, we can find that the offer's AbortOfferStatus is not actually updated, because the data location of originOfferInfo is memory rather than storage.
As a result, the origin offer authority and sub offer authority can call to abort, but the taker of the sub offer cannot abort their stock and their collaterals will be stuck. This is because to abort bid taker, the AbortOfferStatus of the stock's pre offer must be Aborted:
Unfortunately, this status is only updated to Aborted when abortAskOffer is called on the origin offer, meaning AbortOfferStatus of any sub offer won't be updated, despite the sub offer has already been aborted.
Imagine the following scenario:
Alice creates an ask offer, OfferSettleType is Turbo;
Bob creates an taker against the offer, and sublist a sub offer, preOfferInfo is Alice's origin offer;
Cathy fills bob's sub offer, preOfferInfo is Bob's sub offer;
Because the origin offer's AbortOfferStatus is not actually updated, Alice is able to abort the offer and receive refund, the origin offer's abortOfferStatus is updated to Aborted;
Bob calls to abort bid taker, also receives refund, the sub offer's abortOfferStatus is not updated;
However, when Cathy calls to abort bid taker, the transaction will be reverted because the sub offer's abortOfferStatus is NOT Aborted.
Please copy the PoC code into PreMarkets.t.sol to verify:
Offer can be aborted even if there is sub offer listed, and the taker who fill the sub offer will lose their collaterals.
Manual Review
Change origin offer's data location to `storage` when update its AbortOfferStatus:
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.