Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulnerability: Using 0 as a Minimum Amount Allowed in AMMs can Cause Loss of Funds. / Contract: TokenisableRange / Function: claimFee #249

Closed
code423n4 opened this issue Aug 6, 2023 · 4 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-260 grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/GoodEntry-io/ge/blob/8a2686b14114edbd1ec523d79304ed678cc2e915/contracts/TokenisableRange.sol#L194-L201

Vulnerability details

Impact

No slippage protection on call to uniswap increase Liquidity function.

Proof of Concept

The amount0Min, amount1Min in the uniswap increaseLiquidity function are being set to 0, there is no slippage protection, so you are allowing to receive 0 tokens back without reverting the tx.

(uint128 newLiquidity, uint256 added0, uint256 added1) = 
   POS_MGR.increaseLiquidity(INonfungiblePositionManager.IncreaseLiquidityParams({
          tokenId: tokenId,
          amount0Desired: fee0,
          amount1Desired: fee1,
          amount0Min: 0,
          amount1Min: 0,
          deadline: block.timestamp
   })

Uniswap recommends using these parameters as slippage protection in production:
https://docs.uniswap.org/contracts/v3/guides/providing-liquidity/increase-liquidity

Tools Used

Manual Code Review.

Recommended Mitigation Steps

Add slippage protection to the function.

Assessed type

Uniswap

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Aug 6, 2023
code423n4 added a commit that referenced this issue Aug 6, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #78

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #260

@c4-judge
Copy link

gzeon-c4 marked the issue as unsatisfactory:
Insufficient proof

@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Aug 20, 2023
@c4-judge
Copy link

gzeon-c4 changed the severity to QA (Quality Assurance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-260 grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

4 participants