In the PreMarkets
contract in the listOffer
function, we do not update abortOfferStatus
in the storage only inside memory variable.
In the PreMarkets
contract in the listOffer
function, we do not update abortOfferStatus
in the storage. In the following code section we update the data in the memory
variable and do not save the new value to the storage
anywhere:
This vulnerability allows a maker, who created an ask offer with Turbo mode, to call the abortAskOffer
function at any moment, get a refund, all the commission from child offers and he will not need to settle points afterwards.
To run the test, it is enough to put its code into PreMarkets.t.sol file
Because abortOfferStatus
has not been updated in the listOffer
function, the user will be able to call abortAskOffer
because abortOfferStatus
will still be Initialized
.
Thanks to this vulnerability, the maker will be able to get all commissions from child offers and abort the original offer at the last moment.
The bug was discovered through a manual audit of the contracts code. A unit test was written to test the validity of the vulnerability and demonstrate it.
Change originOfferInfo
variable from memory
to storage
:
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.