A vulnerability has been identified in the _splitWeightAndMultipliers function of the QuantAMMWeightedPool contract. The function incorrectly maps multipliers to weights for tokens beyond the first four positions in multi-token pools.
The function accepts an input array structured as:
[w1,w2,w3,w4,w5,w6,w7,w8,m1,m2,m3,m4,m5,m6,m7,m8]
And attempts to reorganize it into two arrays structured as:
[w1,w2,w3,w4,m1,m2,m3,m4] and [w5,w6,w7,w8,m5,m6,m7,m8]
However, the current implementation contains a critical error in its multiplier mapping logic:
When mapping multipliers for tokens 5-8, the function uses an incorrect offset (i4 + tokenLength) to locate multipliers in the source array. This mathematical error means that for each token index i beyond the first four tokens, its multiplier is being read from position (i + 4) + tokenLength instead of the correct position tokenLength + (i + 4).
For example, in an 8-token pool setup, when attempting to read the multiplier for token 5 (i=0 in the second loop), the function incorrectly reads from position 12 (4 + 0 + 8) instead of position 13 (8 + 4 + 0). This offset error cascades through all remaining tokens, causing a systematic misalignment between weights and their corresponding multipliers.
This misalignment propagates through the pool's core pricing mechanism since weight calculations directly influence the spot price between any two tokens in the pool via the weighted geometric mean formula. The error compounds over time through the weight interpolation mechanism, where each block's actual weight is calculated using these mismatched multipliers. This creates a compounding deviation from the intended weight trajectory, leading to systematic mispricing in any swap involving tokens 5-8 and incorrect valuation of liquidity providers' pool shares.
The severity is amplified by the contract's role in automated market making, where each mispriced trade creates an opportunity for arbitrage against the intended pool behavior, potentially draining value from liquidity providers through mathematically incorrect price curves.
Modify the multiplier mapping logic in the second loop to correctly access multiplier positions:
Add input validation:
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.