Underflow could happened when calculating Uniswap V3 position's fee growth and can cause operations to revert #480
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
🤖_105_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Oracle.sol#L472
Vulnerability details
Impact
Detailed description of the impact of this finding.
When operations need to calculate Uniswap V3 position's fee growth, it used similar function implemented by uniswap v3. However, according to this known issue : Uniswap/v3-core#573. The contract is implicitly relies on underflow/overflow when calculating the fee growth, if underflow is prevented, some operations that rely on fee growth will revert.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
It can be observed that current implementation of getFeeGrowthInside not allow underflow/overflow to happen when calculating feeGrowthInside0X128 and feeGrowthInside1X128, because the contract used solidity >=0.8.0.
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/V3Oracle.sol#L472
This could impact crucial operations that rely on this call, such as liquidation, and could revert unexpectedly. This behavior is quite often, especially for pools that use lower fees.
Tools Used
Use unchecked when calculating feeGrowthInside0X128 and feeGrowthInside1X128.
Recommended Mitigation Steps
Assessed type
Context
The text was updated successfully, but these errors were encountered: