-
Notifications
You must be signed in to change notification settings - Fork 0
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
Due to underflow in _createLegInAMM() it's possible to create position with huge amount of liquidity #332
Comments
Picodes marked the issue as duplicate of #516 |
Picodes marked the issue as selected for report |
dyedm1 marked the issue as disagree with severity |
This is definitely an issue, but |
dyedm1 (sponsor) confirmed |
As the SFPM is meant to be used by other protocols than Panoptic itself and as there is really an issue here impacting an important function, Medium severity seems justified. |
Picodes marked the issue as satisfactory |
Picodes changed the severity to 2 (Med Risk) |
Picodes marked issue #516 as primary and marked this issue as a duplicate of 516 |
No impact is described in this report aside from the contract's state being wrong |
Lines of code
https://github.com/code-423n4/2023-11-panoptic/blob/main/contracts/SemiFungiblePositionManager.sol#L979
Vulnerability details
Impact
When burning a Long position, there is an underflow issue in the
_createLegInAMM()
function. As a result, someone can exploit underflow to turn their Short position with a small amount of liquidity into one that has a huge amount of liquidity (close to2^128-1
) in theremovedLiquidity = currentLiquidity.leftSlot()
part.Alice can create a Short position in
USDC<>ETH
pool for ETH and a few Long positions with a tiny amount. Further, she burns her tokens for the Long position and triggers underflow. From that point, she has a Short position with a huge amount of liquidity without supplying that amount of ETH.Proof of Concept
USDC<>ETH
pool: asset - ETH, strike - 202265, width - 4095, positionSize - 12300000 wei.USDC<>ETH
pool: asset - ETH, strike - 202265, width - 4095, positionSize - 50000 wei. BecausepositionSize
is tiny, Alice will get50000
amount of ERC1155 token for each mint, but liquidity amount for such tiny position is 0.Recommended Mitigation Steps
Inside _createLegInAMM() check that
removedLiquidity
is greater thanchunkLiquidity
.Assessed type
Math
The text was updated successfully, but these errors were encountered: