Closed sherlock-admin2 closed 4 months ago
2 comment(s) were left on this issue during the judging contest.
z3s commented:
_addLiquidity has _whenStrategyNotPaused(); check
DHTNS commented:
Invalid -> If the contract is paused all positions are burned so why would admin call setPositionWidth if there is no position to begin with?
bughuntoor
high
Changing
positionWidth
while protocol is paused will lose most of the contract's fundsSummary
Changing
positionWidth
while protocol is paused will lose most of the contract's fundsVulnerability Detail
When the protocol's paused, all liquidity is removed from the pool up until it is
unpaused
. However, if during the pausepositionWidth
is changed, this will still add liquidity to the pool.While this is a problem not only because funds are deposited during
emergency
mode, but also because then after some time, whenunpause
is called,_addLiquidity
will be called again and will overwrite thenftId
values, making old NFT ids inaccessible and forever lost.Since the two functions are callable by different wallets/ timelocks, a bad timing of transactions might cause this to happen. Furthermore, if timelock is used for the calling of these functions, a mismatch of transaction order might also cause this.
Same issue with
moveTicks
which is callable by RebalancerImpact
Loss of funds
Code Snippet
https://github.com/sherlock-audit/2024-05-beefy-cowcentrated-liquidity-manager/blob/main/cowcentrated-contracts/contracts/strategies/velodrome/StrategyPassiveManagerVelodrome.sol#L769
Tool used
Manual Review
Recommendation
If
positionWidth
is changed while contract is paused, do not add liquidity