Option Sellers can DoS Option Buyers using EOA Accounts from exercising options that are ITM. #274
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
edited-by-warden
grade-a
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_274_group
AI based duplicate group recommendation
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/SemiFungiblePositionManager.sol#L773-L782
https://github.com/code-423n4/2024-04-panoptic/blob/main/contracts/SemiFungiblePositionManager.sol#L455-L456
Vulnerability details
Impact
Option Buyers could not be able to exercise their options when they are ITM, which could end up the Option Buyers not been able to make a profit on their trading strategies.
Proof of Concept
When long Options are ITM, the Option Buyers are earning a profit, as opposed to Option Sellers who are losing money. So, Option Buyers have the incentive to close/burn/exercise their long options and walk away with their profits, while, Option Sellers could be incentivized (if there might be a way) to try to DoS Option Buyers from closing their long position while they are ITM.
When burning/closing a long option that is ITM, the SFPM determines the amount of tokens that needs to be swapped in order for the position to be closed. When a PanopticPool is closing an ITM option, the payer to the UniV3Pool for doing the swap is the PanopticPool itself (those swapped tokens are later charged to the user), this means, when burning a long ITM option, the SFPM will send funds from the PanopticPool to the UniV3Pool. But this means that the PanopticPool needs to have those tokens on its balance, else, the swap will revert because the payer (PanopticPool) doesn't have enough funds.
=>
swapInAMM(...)
← if position is ITM⇒
_univ3pool.swap(...)
← Does a swap on the UniV3Pool⇒
uniswapV3SwapCallback(...)
← SFPM receives the callback from Uniswap and pays the amount0 and amount1 of tokens specified by the UniV3Pool. The payer is the PanopticPool who called the SFPM.burnTokenizedPosition(...)⇒ If the swap reverts, the whole tx will revert, causing the OptionBuyer to not be able to exercise his position that is ITM.
Option Sellers who are not willing to accept a loss can frontrun Option Buyers before their long ITM options are burnt, the Option Sellers would mint short options to drain the available liquidity on the PanopticPool and move it to the UniV3Pool, this would cause that the PanopticPool runs out of available funds, because all the funds were moved to the UniV3Pool due to the new short options.
This would cause that when the OptionBuyer tries to close his long option ITM to fail, the reason is because the PanopticPool would have not enough balance to pay for the required tokens to do the swap.
Option Buyers can't forceExercise the new short positions because the forceExercise() only works for positions with a long, but if the new positions contains only shorts, then, those positions can't be forceExercised.
When minting shorts, it is not enforced that shorts can't deploy all the available liquidity on the PanopticPool to the UniV3Pool (only when minting longs there is a check to validate the spread between liquidity on the PanopticPool and the UniV3Pool)
Tools Used
Manual Audit
Recommended Mitigation Steps
I think there a couple of ways to mitigate this problem and don't leave any possibility to OptionSellers from forcefully DoSing the Option Buyers from closing their ITM long options.
Implement a liquiditySpread check when minting shorts and enforce that a minimum amount of liquidity must be available on the PanopticPool at all times. In this way, the Option Sellers can't move all the liquidity to the UniV3Pool by continously creating new shorts
Create some bundlers that allows the Option Buyers using EOA accounts to deposit tokens to the CollateralTrackers and in the same tx they can also burn their ITM long options, in this way, the OptionSellers can't even touch the new liquidity added specifically to cover for the swap while closing the ITM long option.
Assessed type
Context
The text was updated successfully, but these errors were encountered: