DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing zero-address checks in bridge contracts

Summary

In both bridge contracts there is a missing zero address check in the constructor for the input parameter diamondAddr, which could allow immutable diamond to be mistakenly set to 0 address.

Impact

All of the functions which alter state in these two contracts are locked by a modifier which only allows modification by the diamondAddr. These functions would be unusable if zero address is passed in the constructor to set the diamond variable.

Tools Used

Manual Code Review

Recommendations

Add zero address check to the constructor for both contracts; BridgeReth.sol & BrdigeSteth.sol, before setting diamond to the passed in parameter diamondAddr.

constructor(IRocketStorage rocketStorageAddress, address diamondAddr) {
rocketStorage = IRocketStorage(rocketStorageAddress);
>>> require(diamondAddr != address(0), "BridgeReth: diamond address cannot be the zero address");
diamond = diamondAddr;
// @dev (gas) use immutable instead of constant
// See https://github.com/ethereum/solidity/issues/9232#issuecomment-646131646
RETH_TYPEHASH = keccak256(
abi.encodePacked("contract.address", "rocketTokenRETH")
);
ROCKET_DEPOSIT_POOL_TYPEHASH = keccak256(
abi.encodePacked("contract.address", "rocketDepositPool")
);
}
constructor(ISTETH _steth, IUNSTETH _unsteth, address diamondAddr) {
steth = ISTETH(_steth);
unsteth = IUNSTETH(_unsteth);
>>> require(diamondAddr != address(0), "BridgeReth: diamond address cannot be the zero address");
diamond = diamondAddr;
steth.approve(
address(unsteth),
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
);
}
Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Zero address checks

Support

FAQs

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