Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: medium
Invalid

Lack of Input Validation in OperatorVCS.setOperator

Summary

The setOperator function in the OperatorVCS contract allows setting the operator address for a vault but lacks input validation. Specifically, it does not check whether the new operator address is valid (e.g., not the zero address). This could lead to misconfiguration or unintended behavior.

Vulnerability Details

In OperatorVCS, the setOperator function:

function setOperator(uint256 _index, address _operator) external onlyOwner {
IOperatorVault(address(vaults[_index])).setOperator(_operator);
}

While the setOperator function in OperatorVault does perform some checks:

function setOperator(address _operator) public onlyOwner {
if (operator != address(0)) revert OperatorAlreadySet();
if (_operator == address(0)) revert ZeroAddress();
operator = _operator;
}

The OperatorVCS function does not validate the _index parameter to ensure it is within bounds of the vaults array. If an invalid index is provided, it could lead to an exception or incorrect behavior.

Impact

  • Misconfiguration: Setting an invalid operator address or incorrect vault index could render the vault unusable or misdirect rewards.

  • Operational Issues: The system may behave unexpectedly if operators are not set correctly.

  • Security Risks: Potential for setting malicious addresses if not properly validated.

Tools Used

Manual code review.

Recommendations

  • Validate Input Parameters:

    • In OperatorVCS.setOperator, add checks to ensure _index is within the bounds of the vaults array.

    • Validate that _operator is not the zero address.

  • Error Handling:

    • Provide informative error messages using require statements.

    • For example:

      require(_index < vaults.length, "Invalid vault index");
      require(_operator != address(0), "Operator address cannot be zero");
  • Consistent Validation:

    • Ensure that input validation is performed at all levels to prevent invalid data from propagating.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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