QuantAMM

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

Oracle Address Validation Missing in MultiHopOracle Constructor

Summary

The MultiHopOracle contract's constructor lacks essential validation for oracle addresses, permitting the initialization of the contract with zero addresses.

Vulnerability Details

Here's the current vulnerable implementation:

constructor(HopConfig[] memory _oracles) {
for (uint i = 0; i < _oracles.length; i++) {
oracles.push(_oracles[i]); // Accepts any address, including address(0)
}
}

https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/MultiHopOracle.sol#L19C4-L23C6

The constructor blindly accepts and stores oracle configurations without verifying the validity of oracle addresses. When _getData() attempts to interact with these addresses, calls to a zero address will revert:

function _getData() internal view override returns (int216 data, uint40 timestamp) {
HopConfig memory firstOracle = oracles[0];
(data, timestamp) = firstOracle.oracle.getData(); // Will revert if oracle is address(0)
// ... rest of the function
}

Impact

Price queries will fail when encountering zero addresses.

Tools Used

Manual review

Recommendations

Include zero-address check:

constructor(HopConfig[] memory _oracles) {
require(_oracles.length > 0, "MultiHopOracle: empty oracle array");
for (uint i = 0; i < _oracles.length; i++) {
require(
address(_oracles[i].oracle) ! = address(0),
"MultiHopOracle: invalid oracle address"
);
oracles.push(_oracles[i]);
}
}
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!