In the UpliftOnlyExample::afterUpdate
function, when an LP NFT is transferred, the lpTokenDepositValue
is updated to the current value (lpTokenDepositValueNow
) without accounting for the uplift fee up to that point. This allows users to transfer the NFT to another address and back, effectively resetting the fee calculation and bypassing the uplift fee.
When an LP NFT is transferred, the following code updates the lpTokenDepositValue
to the latest value:
This logic ignores any uplift fees that should have been applied to the NFT up to the transfer. If the NFT is transferred back, the uplift fee is effectively reset, and the user avoids paying the fee entirely.
Consider this test case:
Bob adds liquidity and receives an LP NFT.
The pool's value doubles.
Bob transfers the NFT to Alice.
Alice transfers the NFT back to Bob.
When Bob removes liquidity, no uplift fee is applied despite the price increase.
Here’s the test code:
Users can exploit this vulnerability to avoid paying uplift fees.
Manual code review
Calculate and Deduct Uplift Fee Before Transfer: When transferring the NFT, calculate the uplift fee owed by the current holder and deduct it before resetting the lpTokenDepositValue
.
Likelihood: High, any transfer will trigger the bug. Impact: High, will update lpTokenDepositValue to the new current value without taking fees on profit.
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.