DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

Include checks in `StrategyMainnet.sol` for array size.

Summary

In contract StrategyMainnet.sol function addRoute include checks for size array. Also check of array size where array is implemented so it donot greater than size.

Vulnerability Details

This issue is classified as a Medium Severity finding due to the checking fix size of array params in addRoute function
In the StrategyMainnet.sol:56 contract, the function addRoute has if someone pass input greater than array size.It show different behaviour on the EVM.

https://github.com/Cyfrin/2024-12-alchemix/blob/82798f4891e41959eef866bd1d4cb44fc1e26439/src/StrategyMainnet.sol#L56C1-L65C6

function addRoute(
address[11] calldata _route,
uint256[5][5] calldata _swapParams,
address[5] calldata _pools
) external onlyManagement {
routes[nRoutes] = _route;
swapParams[nRoutes] = _swapParams;
pools[nRoutes] = _pools;
nRoutes++;
}

Impact

  1. To donot show any random behavior.

  2. It invites the DoS (denial of service attack)

Tools Used Manual Review

Recommendations

Include check for array size with require statements

function addRoute(
address[11] calldata _route,
uint256[5][5] calldata _swapParams,
address[5] calldata _pools
) external onlyManagement {
+ require(_route.length == 11 , "Exceed the size of _route");
routes[nRoutes] = _route;
+ require(_swapParams.length == 5, "Exceed the size of _swapParams");
swapParams[nRoutes] = _swapParams;
+ require(_pools.length == 5,"Exceed th size of _pools");
pools[nRoutes] = _pools;
nRoutes++;
}
Updates

Appeal created

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.