Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: high
Valid

`originOfferInfo.abortOfferStatus` remains unupdated in `PreMarkets::listOffer`, as `originOfferInfo` is initialized as memory

Summary

  • The PreMarkets::listOffer is expected to update the abortOfferStatus to SubOfferListed for the Maker, so that they cannot abort the offer as someone is relisting the offer via the stocks.

  • The OfferInfo of the origin offer of Maker is loaded in a variable which is initialized as memory, as a result of which any updations made to it will be temporary not permanent, thus this allows the Maker to abort the offer even if someone has relisted.

Vulnerability Details

  • The vulnerability is present in the listOffer where it assigns the abortOfferStatus to a memory variable which will not be permanent as a result of which after the txn finishes the offer's abort status will remain unchanged, which was expected to be changed to SubOfferListed in the Turbo Mode.

OfferInfo memory originOfferInfo = offerInfoMap[originOffer];
originOfferInfo.abortOfferStatus = AbortOfferStatus.SubOfferListed;
  • The updating of abortOfferStatus to SubOfferListed plays a very crucial role to prevent the Maker from aborting their offer in case offers are relisted by the takers.

  • This gives the Maker the unfair access to abort an offer when the offer is relisted by any taker, and cause the violation of the invariant to not allow any abortion of offer in case their is relisting of offer.

Impact

  • The Maker can abort the offer even if their are relisting in turbo mode.

  • As in turbo mode, the relisters don't stake any collateral, as a result of which the takers who buys from the relisted offer will end up loosing their amount to the relisters as they won't be getting any compensation, as all compensation would be given to initial relisters.

Tools Used

Manual Review

Recommendations

Make the originOfferInfo variable as storage.

- OfferInfo memory originOfferInfo = offerInfoMap[originOffer];
+ OfferInfo storage originOfferInfo = offerInfoMap[originOffer];
Updates

Lead Judging Commences

0xnevi Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-listOffer-originIOfferInfo-storage-memory

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

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.