QuantAMM

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

Lack of Input Validation in `MultiHopOracle.sol::constructor()`, doesn't check for empty array.

Vulnerability Details:

The constructor(HopConfig[] memory _oracles) in the contract MultiHopOracle.sol does not validate the input _oracles. If an empty array is passed, the contract will not function correctly.

constructor(HopConfig[] memory _oracles) {
for (uint i = 0; i < _oracles.length; i++) {
oracles.push(_oracles[i]);
}
}

Pushing an empty array into the oracles array might not cause immediate malfunction but can lead to unexpected behavior in the future, especially when the code interacts with the oracles.length variable.

We know that no users intentionally pass an empty array as input to the constructor. However, still, there's a slight chance of this happening due to errors in user-generated data i.e. a user might accidentally enter an empty array due to a typo or misunderstanding.

Impact:

While an empty array might not be a common exploit attempt, a malicious user could pass a specially crafted EMPTY ARRAY to explode contract functionality. A successful exploit could lead to the contract becoming unusable until a fix is deployed.

Recommended Mitigation:

Add a check to validate user input in MultiHopOracle.sol::constructor i.e:

constructor(HopConfig[] memory _oracles) {
require(_oracles.length > 0, "Oracles array cannot be empty");
for (uint i = 0; i < _oracles.length; i++) {
oracles.push(_oracles[i]);
}
}
Updates

Lead Judging Commences

n0kto Lead Judge 11 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!