Closed sherlock-admin2 closed 2 months ago
Escalate How can this be borderline low As there is lose of funds due to using wrong limits for alternative position.
Its a low, this cause code bloat which could make the contract too large and at most would only last until there is another rebalance call. Won't fix.
There is no 100% surety that in second call this case would not occur again.
Escalate How can this be borderline low As there is lose of funds due to using wrong limits for alternative position.
Its a low, this cause code bloat which could make the contract too large and at most would only last until there is another rebalance call. Won't fix.
There is no 100% surety that in second call this case would not occur again.
The escalation could not be created because you are not exceeding the escalation threshold.
You can view the required number of additional valid issues/judging contest payouts in your Profile page, in the Sherlock webapp.
aman
medium
positionAlt
ticks will not be updated ifamount0==bal1
Summary
The protocol allows owner to update the tick to add liquidity into pool. To set the tick of alternative position the protocol set it ticks on basis of token which values is more then other one. How ever it miss an edge case due to which the ticks for alternative position will not be updated.
Vulnerability Detail
To set or update the tick the owner of strategy will call
setPositionWidth
. This function will claim the current earning , remove the liquidity from pool , update the width of position , set the ticks and add liquidity. The Issue here is in_setTicks
which calls_setAltTick
with latest width . The implementation is given below:First we change the main position ticks and after that we change the ticks for alternative position. lets have a look on
_setAltTick
.lets assume
bal0
is not 0. At line656
we calculate the price foramount0
and in subsequent steps we check ifamount0>bal1
then we update the tick on basis oftokne0
otherwise ontoken1
. However there is chance if bothamount0==bal1
the position will not be updated and keep operating on older ticks which the owner of strategy does not want to use or not that profitable.Impact
The alternative position ticks will not updated and result in lose of profit or unintended behavior which is not required by the owner of strategy i.e using the older ticks.
Code Snippet
https://github.com/sherlock-audit/2024-05-beefy-cowcentrated-liquidity-manager/blob/main/cowcentrated-contracts/contracts/strategies/velodrome/StrategyPassiveManagerVelodrome.sol#L415C14-L415C23 https://github.com/sherlock-audit/2024-05-beefy-cowcentrated-liquidity-manager/blob/main/cowcentrated-contracts/contracts/strategies/velodrome/StrategyPassiveManagerVelodrome.sol#L649-L685
Tool used
Manual Review
Recommendation
Replace
<
or>
check with<=
or>=
in either condition :Duplicate of #38