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

0 stars 0 forks source link

Unclaimed rewards are not deducted when reclaiming an incentive #85

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

broccoli

Vulnerability details

Impact

The reclaimIncentive function of ConcentratedLiquidityPoolManager does not update the rewardsUnclaimed variable after some rewards are reclaimed. Thus, an attacker could add an incentive with a corresponding token, such as DAI, and reclaim the incentive multiple times to drain all the DAI within the manager contract.

Proof of Concept

Referenced code: ConcentratedLiquidityPoolManager.sol#L59-L60

Recommended Mitigation Steps

Subtract incentive.rewardsUnclaimed by amount before the _transfer (which prevents reentrancy attacks).

sarangparikh22 commented 3 years ago

Duplicate of #37