Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Invalid

"Missing Validation for Offer Type in `listOffer` Function

Summary

The listOffer function in the contract is intended to allow the owner of a stock to list a new offer. According to the function's NatSpec documentation and comments, the function should only allow offers of type Ask to be listed. However, the function does not include a necessary check to ensure that the offer type is indeed Ask. This oversight could lead to the incorrect listing of offers that are not of type Ask, potentially violating the intended logic and causing unintended behavior in the marketplace.

Vulnerability Details

The listOffer function is designed to list an offer associated with a stock, ensuring that the marketplace is online and that only Ask offers are listed.

Impact

The impact of this issue is that the function could inadvertently list offers that are not of type Ask, violating the business logic and potentially leading to incorrect behavior in the marketplace. Specifically, this could allow for the creation of offers that do not meet the intended criteria, which could have several negative consequences

Tools Used

Recommendations

Implement Offer Type Check: Add the following check to the listOffer function to ensure that only Ask offers can be listed:

if (offerInfo.offerType != OfferType.Ask) {
revert InvalidOfferType(OfferType.Ask, offerInfo.offerType);
}
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

[invalid] finding-PreMarkets-listOffer-validate-offer-Type

Invalid, explicit check not required. listOffer is for subsequent makers that want to sell points again. Based on the original maker creating offer as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L137-L138), if offerType is ASK, the stockType will default to Bid type, so the check [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L330-L332) is sufficient in ensuring only ask offer can be listed

Support

FAQs

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

Give us feedback!