In OperatorVCS contract, the function removeVault does not properly handle cases where the vault does not exist in the vaults array. As a result, the first element will be mistakely removed.
The primary logical vulnerability in this code lies in the method used to remove a vault from the vaultsToRemove array and the subsequent removal from the vaults array. The issue arises during the element shifting process within the vaults array. After finding the index of the vault to be removed, the code does not properly handle cases where the vault does not exist in the vaults array. If the vault specified by _queueIndex is not found, the index remains zero as initialized, potentially leading to unintended behavior by removing the first element or shifting the wrong index.
If the vault specified by _queueIndex is not found, the first element will be mistakely removed.
Manual Review
To mitigate this issue, checks must be put in place to ensure that the vault being removed exists within the vaults array before proceeding to remove it.
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.