DittoETH

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

Missing check for zero address

Summary

There are several input arguments, that are not checked if they are zero address.

Vulnerability Details

The construcor parameter address _cusd in contracts ShortRecordFacet.sol and ExitShortFacet.sol, _zeth in VaultFacet.sol, the parameters _rethBridge and stethBridge in BridgeRouterFacet.sol and the input parameter diamondAddr in contracts Asset.sol and Ditto.sol are not checked if they are zero addresses (0x0).

Impact

It is a good practice to check if the input addresses are zero addresses. This is because the zero address is often used as a default value in Solidity, and sending tokens to this address will effectively burn them, as they cannot be recovered. Consider adding a requirement to prevent this.

Tools Used

Manual review, VS Code

Recommendations

Add require() to validate the address parameters in constructor in ShortRecordFacet.sol, ExitShortFacet.sol, VaultFacet.sol, BridgeRouterFacet.sol, Asset.sol and Ditto.sol:

In ShortRecordFacet.sol and ExitShortFacet.sol:

constructor(address _cusd) {
require(_cusd != address(0), "CUSD address can not be 0");
cusd = _cusd;
}

In VaultFacet.sol:

constructor(address _zeth) {
require(_zeth != address(0), "ZETH address can not be 0");
carbonZeth = _zeth;
}

In BridgeRouterFacet.sol:

constructor(address _rethBridge, address _stethBridge) {
require(_rethBridge != address(0), "rethBridge address can not be 0");
require(_stethBridge != address(0), "stethBridge address can not be 0");
rethBridge = _rethBridge;
stethBridge = _stethBridge;
}

In Asset.sol:

constructor(address diamondAddr, string memory name, string memory symbol)
ERC20(name, symbol)
{
require(diamondAddr != address(0), "diamond address can not be 0");
diamond = diamondAddr;
}

In Ditto.sol:

constructor(address diamondAddr) ERC20("Ditto", "DITTO") ERC20Permit("Ditto") {
require(diamondAddr != address(0), "diamond address can not be 0");
diamond = diamondAddr;
}
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.