QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

Oracle not validated for zero address in UpdateWeightRunner.sol

Summary

The function setETHUSDOracle() does not check if the address of the oracle is the zero address or not before setting a new oracle.

Vulnerability Details

The function setETHUSDOracle is used to set a new Oracle by the admin for the ETH/USD. But the new Oracle address is not validated against the zero address. This can lead to setting address zero as the Oracle, which means that there will be no Oracle for the pair.

function setETHUSDOracle(address _ethUsdOracle) public {
require(msg.sender == quantammAdmin, "ONLYADMIN");
ethOracle = OracleWrapper(_ethUsdOracle);
emit ETHUSDOracleSet(_ethUsdOracle);
}

Permlink https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/UpdateWeightRunner.sol#L304C5-L308C6

Impact

Can lead to not setting any Oracle for the ETH/USD. This can halt protocol operations when querying the oracle for price. Submitted as low because the likelihood is low and funds may not be lost.

Tools Used

Manual Review

Recommendations

Add check to ensure that new address assed in parameter is not the zero address

function setETHUSDOracle(address _ethUsdOracle) public {
require(msg.sender == quantammAdmin, "ONLYADMIN");
+ require(_ethUsdOracle != address(0), "CannotBeZeroAddress");
ethOracle = OracleWrapper(_ethUsdOracle);
emit ETHUSDOracleSet(_ethUsdOracle);
}
Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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

Give us feedback!