The contract GlobalConfigurationBranch.sol contains a risky loop that iterates over a range of values defined by lowerBound
and upperBound
in the external function getAccountsWithActivePositions
.
There are no input validations to ensure that lowerBound
<= upperBound
. If lowerBound > upperBound
, this can lead to issues because the smart contract creates an array of size upperBound - lowerBound + 1
, which could underflow leading to potentially massive gas costs and in the worst-case scenario could result in the contract becoming stuck if it exceeds the block gas limit.
The getAccountsWithActivePositions
function also does not include any sanity checks to determine that the provided bounds correspond to valid values within the range of accountsIdsWithActivePositions
.
Any user can call this function with values of lowerBound
and upperBound
greater than the length of accountsIdsWithActivePositions
array or lowerBound > upperBound
which can result in invalid/access to out-of-bound array, or underflow.
Manual review
You should validate the provided lower and upper bounds to ensure that they correspond to valid values within accountsIdsWithActivePositions
range before initiating the loop. You should also ensure that lowerBound <= upperBound
. Incorporating require statements with proper error messages to verify these bounds could help mitigate this issue.
For example,
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.