Closed code423n4 closed 1 year ago
141345 marked the issue as duplicate of #78
141345 marked the issue as duplicate of #260
gzeon-c4 changed the severity to QA (Quality Assurance)
gzeon-c4 marked the issue as grade-c
Hey, can you please have another look at this function, its a valid medium and historically its judged as medium here are a references
The guard against slippage for the function referenced in your issue is placed here
Lines of code
https://github.com/code-423n4/2023-08-goodentry/blob/71c0c0eca8af957202ccdbf5ce2f2a514ffe2e24/contracts/TokenisableRange.sol#L198-L199
Vulnerability details
Impact
The presence of the front-running vulnerability in the
claimFee()
function can have significant repercussions for users. Exploiting this vulnerability enables malicious actors to prioritize their transactions, potentially leading to unfavorable prices for other users. Consequently, users who initially submitted their transactions may end up receiving worse prices than they anticipated. This can result in financial losses.Proof of Concept
The
claimFee()
function in the TokenisableRange.sol code is responsible for claiming fee. However, it suffers from a front-running vulnerability due to the inadequate specification of minimum token amounts (amount0Min and amount1Min).When the amount0Min and amount1Min parameters are both set to 0, the code allows any amount of token0 and token1 to be accepted during the fee claiming process. This lack of minimum token amount validation creates an opportunity for attackers to manipulate the transaction and impact the price received by the victim.
Malicious users can monitor pending transactions and quickly execute their own transaction with higher fees, effectively "sandwiching" the original transaction. By manipulating the price, the attacker can cause the original transaction to receive unfavorable rates, resulting in financial harm to the user.
In the below instances, a call to Uniswap V3 is made and
amount0Min
andamount1Min
are each set to 0, which allows for 100% slippage tolerance. This means that the action could lead to the caller losing up to 100% of their tokens due to slippage.Tools Used
Manual review
Recommended Mitigation Steps
Implement it like you have done in
withdraw()
function (take if as input from user)Assessed type
Uniswap