stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: low
Invalid

Missing checks for address 0 in constructor

Description

There are smart contract constructor with non include checks for address zero, which could lead to potential vulnerabilities in the system. It is important to implement proper validation to ensure that the address zero is not used in the constructor, as this could result in unexpected behavior or security risks.

Impact

The absence of checks for address zero in the constructor could potentially lead to security vulnerabilities or unexpected behavior in the system. It is crucial to address this issue to maintain the integrity and security of the codebase.

Recommendation

It is recommended to implement checks for address zero in the constructor to mitigate potential security risks and ensure the robustness of the system.

// contracts/core/RewardsInitiator.sol
constructor(address _stakingPool, address _sdlPoolCCIPController) {
+ if (_stakingPool == address(0) || _sdlPoolCCIPController == address(0)) {
+ revert InvalidAddress();
+ }
stakingPool = IStakingPool(_stakingPool);
sdlPoolCCIPController = ISDLPoolCCIPControllerPrimary(_sdlPoolCCIPController);
}
// contracts/core/ccip/base/SDLPoolCCIPController.sol
constructor(
address _router,
address _linkToken,
address _sdlToken,
address _sdlPool,
uint256 _maxLINKFee
) CCIPReceiver(_router) {
+ if (
+ _linktToken == address(0) ||
+ _sdlToken == address(0) ||
+ _sdlPool == address(0)
+ ) {
+ revert InvalidAddress();
+ }
linkToken = IERC20(_linkToken);
sdlToken = IERC20(_sdlToken);
sdlPool = _sdlPool;
maxLINKFee = _maxLINKFee;
linkToken.approve(_router, type(uint256).max);
sdlToken.approve(_router, type(uint256).max);
}
// contracts/core/ccip/RESDLTokenBridge.sol
constructor(
address _linkToken,
address _sdlToken,
address _sdlPool,
address _sdlPoolCCIPController
) {
+ if (
+ _linktToken == address(0) ||
+ _sdlToken == address(0) ||
+ _sdlPool == address(0) ||
+ _sdlPoolCCIPController == address(0)
+ ) {
+ revert InvalidAddress();
+ }
linkToken = IERC20(_linkToken);
sdlToken = IERC20(_sdlToken);
sdlPool = ISDLPool(_sdlPool);
sdlPoolCCIPController = ISDLPoolCCIPController(_sdlPoolCCIPController);
}
// contracts/core/ccip/WrappedTokenBridge.sol
constructor(
address _router,
address _linkToken,
address _token,
address _wrappedToken
) CCIPReceiver(_router) {
+ if (
+ _router == address(0) ||
+ _linkToken == address(0) ||
+ _token == address(0) ||
+ _wrappedToken == address(0)
+ ) {
+ revert InvalidAddress();
+ }
linkToken = IERC20(_linkToken);
token = IERC20(_token);
wrappedToken = IWrappedLST(_wrappedToken);
linkToken.approve(_router, type(uint256).max);
token.approve(_wrappedToken, type(uint256).max);
wrappedToken.approve(_router, type(uint256).max);
}
Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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