QuantAMM

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

Lack of exact validation for _parameters used for useRawPrice

Summary

Some rules do not validate the last parameter used for determining useRawPrice . And only validate the length.

Vulnerability Details

ChannelFollowingUpdateRule properly validates the final element in _parameters during validParameters

// Check parameter 7 is scalar (length 1) and is either 0 or 1
if (_parameters[6].length != 1) return false;
if (_parameters[6][0] != 0 && _parameters[6][0] != PRBMathSD59x18.fromInt(1)) return false;

While:

PowerChannelUpdateRule

if (
// @audit only validates length
(parameters.length == 2 || (parameters.length == 3 && parameters[2].length == 1)) &&
(parameters[0].length > 0) &&
(parameters[1].length == parameters[0].length)
) {

MomentumUpdateRule

// @audit only validates length
if (_parameters.length == 1 || (_parameters.length == 2 && _parameters[1].length == 1)) {

AntimomentumUpdateRule

// @audit only validates length
if (_parameters.length == 1 || (_parameters.length == 2 && _parameters[1].length == 1)) {

In all the above rules (PowerChannelUpdateRule, MomentumUpdateRule and AntimomentumUpdateRule) the final value can be set to anything as longs as it's length matches. Which would fail to correctly set useRawPrice

if (_parameters.length > 1) {
locals.useRawPrice = _parameters[1][0] == ONE;
}

Impact

Validation should only allow values ONE or 0. As any value other than ONEwill fail to enable useRawPrice.

Tools Used

Manual review.

Recommendations

Repeat the same validation used in ChannelFollowingUpdateRule.

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!