In the QuantAMMWeightedPoolFactory contract, pool creation lacks upfront validation that weights sum to FixedPoint.ONE (1e18). This is particularly concerning for Balancer V3's QuantAMM pools, where weight normalization is crucial for the correct functioning of their automated weight adjustment mechanisms.
The vulnerability lies in the delayed validation approach - weights are only checked after pool deployment in _setInitialWeights(). This creates several serious issues in the context of Balancer's architecture. Most critically, since QuantAMM pools rely on sophisticated weight interpolation and automated adjustments over time, any deviation from proper weight normalization could compound through the pool's lifecycle, potentially destabilizing the entire automated market making strategy. Additionally, the lack of early validation creates an attack vector where malicious actors could front-run pool deployments with invalid weights, forcing legitimate deployments to fail after incurring significant gas costs.
Add weight validation in the factory before pool creation:
Consider adding a helper function for weight normalization:
Add explicit weight bounds checks:
These changes ensure weight validation happens early in the pool creation process, preventing unnecessary gas costs and maintaining the economic invariants of the system.
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.