Tadle

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

Incorrect Authority Check in DeliveryPlace Contract

Description

In the DeliveryPlace contract, there is an important inconsistency between the documented behavior and the actual implementation of authority checks in the settleAskTaker function.

if (_msgSender() != offerInfo.authority) {
revert Errors.Unauthorized();
}
  • The comment states: "caller must be stock authority"

  • The implementation checks for offer authority

This discrepancy suggests that the implemented authority checks may not align with the intended access control design. The presence of correct stock authority checks in other parts of the contract further indicates that these functions may be incorrectly implemented.

Impact

The potential impacts of this vulnerability include:

  1. Unauthorized Access: Incorrect authority checks could allow unauthorized parties to settle ask takers, potentially manipulating the market or causing financial losses.

  2. Inconsistent Behavior: The discrepancy between different function's authority checks could lead to unpredictable and inconsistent contract behavior.

Mitigation

To address this vulnerability, we recommend the following steps:

  1. For settleAskTaker: Change the authority check to use stockInfo.authority:

    if (_msgSender() != stockInfo.authority) {
    revert Errors.Unauthorized();
    }
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.