The identified logical vulnerability lies in the onAfterRemoveLiquidity function, specifically around the calculation of the feePerLP variable and the potential for it to exceed 100%.
In UpliftOnlyExample contract, the onAfterRemoveLiquidity function will charge LP fees:
The way the condition checks for localData.lpTokenDepositValueChange results in a mathematically possible situation where the fee could exceed the equity held in the liquidity token, effectively allowing for "negative" fee scenarios. When feePerLP exceeds its proper bounds, it can lead to disproportionate fees being deducted from user withdrawals.
The following line contains the logic that allows this exploit:
If localData.lpTokenDepositValueChange is significantly high due to improper value calculations, this could cause feePerLP to surpass localData.amountLeft or even become an unintended negative value, resulting in losses for users.
The impact is HIGH and the likelihood is LOW, so the severity is MEDIUM
Manual Review
To fix the identified logical vulnerability in the onAfterRemoveLiquidity function, we need to ensure that the computed feePerLP does not exceed 100% of the total deposit being withdrawn. This can be done by implementing appropriate checks and constraints to cap the feePerLP calculation and ensure it remains within reasonable bounds.
Likelihood: Low, will happen only if benefits are huge. (x50 to take 100%, x25 to take 50%). Impact: feePerLP will indefinitely increase, taking users profits and finaly DoS the function.
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.