Tadle

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

settleAskTaker() is permanently DOS'd because of infeasible condition

Summary

settleAskTaker() is permanently DOS'd because of infeasible condition that checks if the settler is offerInfo.authority.

Vulnerability Details

The purpose of this function is for a taker to settle his ask stocks, in other words taker should give points to the maker who bought them.

The problem comes when we reach this condition in the code:

if (status == MarketPlaceStatus.AskSettling) {
if (_msgSender() != offerInfo.authority) {//@audit-high should be stock authority
revert Errors.Unauthorized();
}

Here as we can see msgSender should be offerInfo.authority which is hardly the case as this msgSender is the taker. In order to correct that we need to enforce this condition if (_msgSender() != stockInfo.authority).

This way the check is correct and we can procced with the logic below.

Impact

High

Tools Used

Manual review

Recommendations

Change the check to if (_msgSender() != stockInfo.authority)

Updates

Lead Judging Commences

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

finding-PreMarkets-settleAskTaker-wrong-stock-authority

Valid high severity, when taker offers are created pointing to a `offer`, the relevant `stockInfoMap` offers are created with the owner of the offer aka `authority`, set as the creater of the offer, as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L245). Because of the wrong check within settleAskTaker, it will permanently DoS the final settlement functionality for taker offers for the maker that listed the original offer, essentially bricking the whole functionality of the market i.e. maker will always get refunded the original collateral, and takers will never be able to transact the original points put up by the maker. This occurs regardless of market mode.

Support

FAQs

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