QuantAMM

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

Potential Division by Zero in `calculateBlockNormalisedWeight`

Summary

Potential Division by Zero in calculateBlockNormalisedWeight

Vulnerability Details

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

Impact

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.

Tools Used

Recommendations

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.

Updates

Lead Judging Commences

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

Give us feedback!