The afterUpdate
function of the contract fails to enforce a check limiting the number of deposits per user to 100. While the deposit
function correctly reverts with a TooManyDeposits
error when a user exceeds 100 deposits, the afterUpdate
function does not apply the same restriction, allowing transferred users to bypass this limit. A malicious user can use this to transfer dust amounts to another users to prevent him removing liquidity.
The contract enforces a limit of 100 deposits per user for the deposit
function by checking the number of deposits in poolsFeeData[pool][msg.sender]
. If this limit is exceeded, the transaction is reverted.
However, the afterUpdate
function, which is responsible for handling transfers, does not include a similar check. This allows users who receive LP tokens via transfer to accumulate more than 100 deposits, bypassing the limit set by the protocol.
A malicious user can exploit this vulnerability to perform a denial-of-service (DoS) attack by transferring multiple small (dust) deposits to another user. This abuse causes the recipient's poolsFeeData
array to grow excessively, making operations like withdrawing liquidity or transferring position NFTs increasingly gas-intensive due to the iterative for
loops.
Users can bypass the protocol-imposed limit of 100 deposits.
Malicious actors can render key operations like liquidity removal or position transfers infeasible for targeted users Accumulating a large number of deposits for a single user can DOS removing liquidity and transfering position because of increased gas cost. If the loop iterates many times, it can quickly exceed the gas limit, causing the transaction to fail.
Manual
Add a check in the afterUpdate
function to ensure the number of deposits for the recipient user does not exceed 100.
Likelihood: Medium/High, anyone can receive an unlimited NFT number but will cost creation of LP tokens and sending them. Impact: Low/Medium, DoS the afterUpdate and addLiquidityProportional but will be mitigable on-chain because a lot of those NFT can be burn easily in onAfterRemoveLiquidity.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.