Offer creator's abort offer status is not updated correctly, when a subsequent trader buys a stock from him and later on lists it. This will allow the origin offer creator to be cancel the ask offer, if in Turbo mode, which is not intended design.
Having a closer look at the PreMarkets::listOffer()
function:
Reading the natspec and the code, it's understandable that if the initial offer's settle type is Turbo, it should change the abort status to SubOfferListed
, following the abort offer status enum:
It means that someone already traded and relisted the offer, so the original creator should not be able to abort it. The abortAskOffer
function confirms it:
However it can be noticed that the memory
keyword is used when retrieving the origin offer's data:
Based on how Solidity works, this will not change any state.
Here is a scenario:
Alice, creates an offer in Turbo mode = AbortOfferStatus.Initialized
, means non-existent offer yet
Bob takes it, and then lists the offer
This should change the status to origin offer's status to = AbortOfferStatus.SubOfferListed
, so it can't be a aborted following the abortAskOffer
function
Alice still can abort her offer, which unintended design
Low: as per CodeHawks docs for severity: "However, a function might be incorrect, the state might not be handled appropriately, etc". Also this is not the protocol's intended idea.
Manual Review
Change the memory
keyword with the storage
keyword, in the PreMarkets::listOffer()
:
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.