A position with sufficient profit can withdraw all their collateral while still having the position open. A user can guarantee that they will incur no liquidation fee if they were ever to get liquidated.
All a user would have to do is hold a position where the unrealized PnL exceeds the size of the position. At this point, they can withdraw all their collateral. If the user opts to later close the position, they will receive all of their profit, and if the position reaches a liquidatable state, they will incur no liquidation fee as there is no collateral to take from. With the amount of computation a liquidation takes when multiple positions exist, that would leave the liquidator at a non-negligible loss.
Because there is no minimum collateral check, a user is able to hold an unfair position where if the user wins, they get the profit, and if the user loses, the liquidator and protocol get nothing. This asymmetric risk situation puts the protocol and liquidator at an unfair disadvantage since they are providing the service and liquidity.
Alice opens a long position with 100 USDC of collateral and 100 size.
The market that Alice is a part of increases in price to the point that her unrealized PnL is $110.
Alice sees that she is in a lot of profit but would like to hold the position without the risk of paying a liquidation fee or keeping her assets illiquid.
Alice withdraws 100% of her collateral but keeps the position open since her unrealized PnL exceeds her size.
Her position loses value and is now liquidatable.
The liquidator goes to liquidate the position, but when he attempts to deduct collateral, there is nothing available. This leads to the isMissingMargin boolean returning true and the liquidator liquidating at a loss.
With the likelihood being medium and the impact being medium, I would rate this as a medium.
The likelihood being medium is because there is no extraordinary state the protocol or network has to be in for this to be pulled off, nor does it involve a lot of initial liquidity. It just takes a user having > 100% profit and then withdrawing their collateral.
The impact is medium as it results in a loss of yield for the liquidator.
Loss of yield for the liquidator.
Manual analysis.
Add a minimum collateral check at the end of withdraw. That combined with the already existing minimum size check would prevent this from happening.
The minimum collateral should at least cover the liquidation fee and could be similar to:
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.