code-423n4 / 2021-09-sushitrident-2-findings

0 stars 0 forks source link

Users cannot receive rewards from `ConcentratedLiquidityPoolManager` if their liquidity is too large #88

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

broccoli

Vulnerability details

Impact

There could be an integer underflow error when the reward of an incentive is claimed, forcing users to wait for a sufficient period or reduce their liquidity to claim the rewards.

Proof of Concept

The unclaimed reward that a user could claim is proportional to the secondsInside, which is, in fact, proportional to the position's liquidity. It is possible that the liquidity is too large and causes secondsInside to be larger than secondsUnclaimed. As a result, the rewards that the user wants to claim exceed the incentive.rewardsUnclaimed and causes an integer underflow error, which prevents him from getting the rewards.

Referenced code: ConcentratedLiquidityPoolManager.sol#L94-L95

Recommended Mitigation Steps

Check whether the rewards exceeds the incentive.rewardsUnclaimed. If so, then send only incentive.rewardsUnclaimed amount of rewards to the user.

sarangparikh22 commented 2 years ago

The problem seems very unlikely to happen, would be great to see a POC.