QuantAMM

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

NumberOfAssets is provided as external param

Summary

In the current implementation of setWeightsManually and setIntermediateValuesManually, the parameter _numberOfAssets is passed explicitly to the function. This design introduces a potential vulnerability: if an incorrect value is provided, the function may fail to properly assert the weights, leading to unintended or erroneous behavior.

Vulnerability Details

Root Cause

The parameter _numberOfAssets is externally supplied when calling the function, which means:

  1. It is dependent on the caller to provide the correct value.

  2. There is no internal validation to ensure that _numberOfAssets aligns with the actual number of assets in the pool.

Exploit Scenario

If _numberOfAssets is less than the correct number of assets, the loop that checks weights will terminate prematurely. This means some weights will not be validated.

Impact

If an incorrect _numberOfAssets is provided:

  • Incorrect Weight Validation: Weights for some assets may not be checked, allowing invalid or unintended values to be set.

  • Economic Risk: Inaccurate weights can lead to incorrect pool pricing or other computational errors.

  • Code Integrity: Reliance on external input for such critical parameters increases the risk of misconfiguration.

Tools Used

Manual Review

Recommendations

Replace the externally supplied _numberOfAssets parameter with an internally derived value. For example, retrieve the number of assets from the pool contract directly:

uint256 numberOfAssets = QuantAMMWeightedPool(_poolAddress).getNumberOfAssets();
Updates

Lead Judging Commences

n0kto Lead Judge 7 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.