The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

No address zero checks in crucial functions

Summary

The setOwner,setWethAddress, setSwapRouter2, setNFTMetadataGenerator, setSmartVaultDeployer, setProtocolAddress, setLiquidatorAddress functions lacks an address check, allowing any address to become the new owner without proper validation and so other functions that requires setting of a new address of new Swap router, NftMetadata, SmartVaultDeployer, ProtocolAddress, LiquidatorAddress. This poses a security vulnerability, as it could lead to unauthorized changes.

Vulnerability Details

The setOwner function does not validate the provided _newOwner address, allowing any address to be set as the new owner.

function setWethAddress(address _weth) external onlyOwner() {
weth = _weth;
}
function setSwapRouter2(address _swapRouter) external onlyOwner() {
swapRouter2 = _swapRouter;
}
function setNFTMetadataGenerator(address _nftMetadataGenerator) external onlyOwner() {
nftMetadataGenerator = _nftMetadataGenerator;
}
function setSmartVaultDeployer(address _smartVaultDeployer) external onlyOwner() {
smartVaultDeployer = _smartVaultDeployer;
}
function setProtocolAddress(address _protocol) external onlyOwner() {
protocol = _protocol;
}
function setLiquidatorAddress(address _liquidator) external onlyOwner() {
liquidator = _liquidator;
}

Without proper address validation, an attacker could call the setOwner function with a malicious address, leading to unauthorized ownership changes.

Impact

https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/LiquidationPool.sol#L83
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L115
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L119
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L123
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L127
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L131
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/SmartVaultManagerV5.sol#L135

Tools Used

Manual review

Recommendations

It is essential to include address validation to ensure that only legitimate and authorized addresses can be set.

Updates

Lead Judging Commences

hrishibhat Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

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