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

Missing Initializer Lock in `UpgradeBranch` Contract

Summary

The UpgradeBranch contract is an upgradable contract that does not use the constructor to disable initializers. While the initialize function is protected by the initializer modifier, it is a best practice to explicitly disable initializers in the constructor to prevent potential vulnerabilities.

Vulnerability Details

The UpgradeBranch contract inherits from Initializable and OwnableUpgradeable. The initializer modifier does protect the initialize function, ensuring it can only be called once. However, not disabling initializers in the constructor can leave the contract vulnerable to future implementation issues or mistakes in the inheritance hierarchy.

Detailed Explanation

The UpgradeBranch contract currently relies on the initializer modifier to protect the initialize function. However, adding a constructor to explicitly disable initializers is a recommended best practice to provide an extra layer of security and prevent potential initialization issues in the future.

contract UpgradeBranch is Initializable, OwnableUpgradeable {
function initialize() public initializer {
// Initialization logic
}
}

To enhance security, the constructor should call _disableInitializers() to lock the initializer functions.

Impact

  • Future Implementation Risks: Future changes or additions to the contract's inheritance hierarchy may introduce initialization vulnerabilities if not properly managed.

Tools Used

Manual review

Recommendations

  1. Disable Initializers in Constructor: Implement a constructor that calls _disableInitializers() to lock the initializer function and prevent potential future initialization vulnerabilities.

Example Fix

contract UpgradeBranch is Initializable, OwnableUpgradeable {
constructor() {
_disableInitializers();
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

UpgradeBranch lacks `_disableInitializers()` in constructor.

Support

FAQs

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

Give us feedback!