Tadle

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

DoS in `PreMarket::createOffer` and `PreMarket::createTaker` Due to Reverting Generated `stockAddr` for a Particular `offerId`

Summary

A potential denial of service (DoS) issue exists in the PreMarket::createOffer and PreMarket::createTaker functions, where the generation of a unique stockAddr can result in a permanent revert if an address collision occurs.

Vulnerability Details

In the PreMarket::createOffer and PreMarket::createTaker functions, after a new stockAddr is generated, it is validated for uniqueness. The function checks if that address has already been generated (i.e., is in use) and reverts if true.

address stockAddr = GenerateAddress.generateStockAddress(offerId);
if (stockInfoMap[stockAddr].authority != address(0x0)) {
revert StockAlreadyExist();
}

The issue arises because these addresses are generated with unique offerIds as their only differentiator. If, by chance, the address uniqueness check fails, these functions will become unusable as every call to them will revert, given that there is no way to skip an offerId.

Impact

While the likelihood of this issue occurring is very low, the impact is severe, as it could render the contract functions unusable for a particular offerId, leading to a permanent denial of service for that specific case.

Tools Used

Manual analysis.

Recommendations

Add a function that allows skipping an offerId, which can only be called by the contract owner. This would provide a contingency plan in the unlikely event of an address collision.


Ask Takers in Turbo Mode Incorrectly Forced to Deposit Collateral

Severity: Low

Summary

In Turbo Mode, ask takers are incorrectly required to deposit collateral, contrary to the intended design of the mode.

Vulnerability Details

In Tadle, there are two trading modes for points: Protected and Turbo.

Despite this design, points sellers who call PreMarket::createTaker and target a Turbo Bidder are still incorrectly required to deposit collateral for their order. The relevant code is as follows:

/// @dev Transfer token from user to capital pool as collateral
uint256 depositAmount = _points.mulDiv(
offerInfo.amount,
offerInfo.points,
Math.Rounding.Ceil
);
uint256 platformFee = depositAmount.mulDiv(
platformFeeRate,
Constants.PLATFORM_FEE_DECIMAL_SCALER
);
uint256 tradeTax = depositAmount.mulDiv(
makerInfo.eachTradeTax,
Constants.EACH_TRADE_TAX_DECIMAL_SCALER
);
ITokenManager tokenManager = tadleFactory.getTokenManager();
_depositTokenWhenCreateTaker(
platformFee,
depositAmount,
tradeTax,
makerInfo,
offerInfo,
tokenManager
);

In this code, depositAmount, platformFee, and tradeTax are computed and used in _depositTokenWhenCreateTaker, which forces collateral to be deposited even in Turbo Mode.

Impact

The incorrect requirement for collateral in Turbo Mode may result in unintended issues and operational inefficiencies.

Tools Used

  • Manual analysis

Recommendations

Update the implementation of PreMarket::createTaker to properly handle Turbo Mode by ensuring that collateral is not required from ask takers in this mode. Verify and adjust the collateral deposit logic based on the trading mode.

Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

krisrenzo Submitter
12 months ago
0xnevi Lead Judge
12 months ago
krisrenzo Submitter
12 months ago
0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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