DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Invalid

GlobalConfigurationBranch::getAccountsWithActivePositions doesnt check if the bounds are out of range or empty

Summary

In the function GlobalConfigurationBranch, we use upper and lower bounds, but we could have

  • Out-of-Bounds Access

    • If upperBound exceeds the length of globalConfiguration::accountsIdsWithActivePositions, it will result in out-of-bounds access, which will cause the function to revert. There should be checks to ensure upperBound is within the valid range.

  • Empty Range Handling

    • If upperBound is less than lowerBound, the function will create an array of negative size (which is not possible) or an array with unexpected size. A check should be added to handle this scenario appropriately.

Vulnerability Details

In the function GlobalConfigurationBranch, failing to check the range of the bound could lead to a revert

Impact

failed view transaction

Tools Used

manual

Recommendations

// Ensure the upperBound is not less than the lowerBound
+ require(upperBound >= lowerBound, "Upper bound must be greater than or equal to lower bound");
// Ensure the bounds are within the valid range
uint256 length = globalConfiguration.accountsIdsWithActivePositions.length();
+ require(lowerBound < length, "Lower bound is out of range"); require(upperBound < length, "Upper bound is out of range")
Updates

Lead Judging Commences

inallhonesty Lead Judge
11 months ago
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.