Potential Division by Zero in calculateBlockNormalisedWeight
The calculateBlockNormalisedWeight function directly divides by timeSinceLastUpdate. If timeSinceLastUpdate is zero, due to multiplierTime being equal to poolSettings.quantAMMBaseInterpolationDetails.lastUpdateIntervalTime, a division by zero error occurs, causing the transaction to revert, which disrupts the normal operation. The absence of a check for timeSinceLastUpdate > 0 makes this a direct vulnerability.
https://github.com/Cyfrin/2024-12-quantamm/blob/main/pkg/pool-quantamm/contracts/QuantAMMWeightedPool.sol#L527
An attacker can front-run a weight update and cause a division by zero error by ensuring that the lastUpdateIntervalTime is equal to the block timestamp when the _calculateMultiplerAndSetWeights function is called, thus causing a denial of service to all users.
Add a check to ensure timeSinceLastUpdate is greater than zero before performing division. If timeSinceLastUpdate is zero, then it can return the weight without calculation.
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.