Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: low
Valid

OperatorVault.sol is initialized with wrong version

Summary

OperatorVault.sol is initialized with wrong version which will cause initialization to always fail.

Vulnerability Details

OperatorVault.sol is initialized with version 3 in its reinitializer.

function initialize(
address _token,
address _vaultController,
address _stakeController,
address _rewardsController,
address _pfAlertsController,
address _operator,
address _rewardsReceiver
>> ) public reinitializer(3) {

But we can see from etherscan, that the previously deployed version is also 3.

function initialize(
address _token,
address _vaultController,
address _stakeController,
address _rewardsController,
address _pfAlertsController,
address _operator,
address _rewardsReceiver
>> ) public reinitializer(3) {

This becomes an issue because the reinitializer(uint8 version) requires that the the newly entered version be less than the previous version which is cached as the _initialized parameter.

modifier reinitializer(uint8 version) {
>> require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
>> _initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}

Impact

Due to the current implementation, initializing the contract will be impossible as it will always fail the _initialized < version requirement with the "Initializable: contract is already initialized" error.

Tools Used

Manual Review

Recommendations

Change the version to one greater than 3

function initialize(
address _token,
address _vaultController,
address _stakeController,
address _rewardsController,
address _pfAlertsController,
address _operator,
address _rewardsReceiver
- ) public reinitializer(3) {
+ ) public reinitializer(4) {
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Some contracts will not be initialized due to an incorrect `reinitializer` versions used

Support

FAQs

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