Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing input validation for DEX swap strategy paths in FeeDistributionBranch.sol::performMultiDexSwap

Summary

The function _performMultiDexSwap lacks validation for the length of dexSwapStrategyIds, which could lead to errors.

Vulnerability Details

  • No validation that dexSwapStrategyIds.length matches assets.length - 1.

  • Could result in array out-of-bounds errors or incomplete swaps.

function _performMultiDexSwap(
AssetSwapPath.Data memory swapPath,
uint256 assetAmount
)
internal
returns (uint256)
{
address[] memory assets = swapPath.assets;
uint128[] memory dexSwapStrategyIds = swapPath.dexSwapStrategyIds;
// No validation that dexSwapStrategyIds.length == assets.length - 1
uint256 amountIn = assetAmount;
for (uint256 i; i < assets.length - 1; i++) {
DexSwapStrategy.Data storage dexSwapStrategy =
DexSwapStrategy.loadExisting(dexSwapStrategyIds[i]);
...
}
return amountIn;
}

Impact

Potential protocol invariants breakage and incomplete swaps.

Tools Used

Manual code review.

Recommendations

  • Validate the length of dexSwapStrategyIds against assets.length - 1.

  • Ensure assets contains at least two elements.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!