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.
The parameter _numberOfAssets
is externally supplied when calling the function, which means:
It is dependent on the caller to provide the correct value.
There is no internal validation to ensure that _numberOfAssets
aligns with the actual number of assets in the pool.
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.
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.
Manual Review
Replace the externally supplied _numberOfAssets
parameter with an internally derived value. For example, retrieve the number of assets from the pool contract directly:
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.