Tadle

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

[H-2] `PreMarkets::createOffer` allows a user to create an offer with `eachTradeTax` more than `Constants.EACH_TRADE_TAX_MAXINUM` allowing the user to even charge 100% of the future sales

Relevant Links

https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L39-L157
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/libraries/Constants.sol#L20

Summary

PreMarkets::createOffer allows a user to create an offer with eachTradeTax more than Constants.EACH_TRADE_TAX_MAXINUM.
The user can even charge eachTradeTax of 10_000 (i.e. 100%).

Vulnerability Details

eachTradeTax should not be more than Constants.EACH_TRADE_TAX_MAXINUM value i.e. 2000 (20%).
The PreMarkets::createOffer only makes sure that the eachTradeTax isn't greater than Constants.EACH_TRADE_TAX_DECIMAL_SCALER i.e. 10_000.

if (params.eachTradeTax > Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
revert InvalidEachTradeTaxRate();
}

Impact

Likelihood: High
Impact: High - User can charge a eachTradeTax value of more than EACH_TRADE_TAX_MAXINUM

Overall severity is High

Tools Used

Manual Review

Recommendations

Change the condition in PreMarkets::createOffer function

- if (params.eachTradeTax > Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
+ if (params.eachTradeTax > Constants.EACH_TRADE_TAX_MAXINUM) {
revert InvalidEachTradeTaxRate();
}
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-off-by-one-Trade-TAX-100%

Similar to issue #1323, Despite this off-by-one error of the intended check, the difference between 99% and 100% is minimal, so I believe whether or not 100% is allowed has minimal impact. Ultimately, takers should not be realistically creating offer with such tradeTax

Appeal created

karanel Submitter
over 1 year ago
karanel Submitter
over 1 year ago
0xnevi Lead Judge
over 1 year ago
karanel Submitter
over 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-tradeTax-over-100%

A maximum tradeTax could be valuable to ensure makers do not abuse the tradeTax mechanism as a form of maker bonus. However, ultimately, it would still be user responsibility to take up offers with reasonable tradeTax. In addition, a maximum is already included in the Constants contract represented by EACH_TRADE_TAX_MAXINUM as seen here https://github.com/Cyfrin/2024-08-tadle/blob/72c93f73a26ec7472868cb509e8b454286810223/src/libraries/Constants.sol#L20

Support

FAQs

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

Give us feedback!