-
Notifications
You must be signed in to change notification settings - Fork 0
BugBusters - User can be liquidated while fund_account is paused #214
Comments
expected behavior |
Escalate for 10 USDC This is a valid medium. Such issues have been accepted as valid before. While the state of contract is paused, liquidation is not paused but adding margin is paused, so user cannot save the position even if they want to. Closing position is not the ideal case, as it results in the loss of oppertunity for the end user. And lastly all big cex and dex in their perpetual trading have the feature to add more margin anytime to save the position from going underwater. Other example of similar issue being valid accepted is from the blueberry contest: |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
recommendation:
User can repay to close position, no loss. The reason this is expected behavior is, when the system is in defensive mode, most activities should be paused, especially adding new or expanding the current position, adding additional fund, etc. In another word, the system should be in "reduce-only" mode. Users are encouraged to exit. So the repay and close is still funcitoning. Users should take their own responsibility for the potential change on their positions, including liquidation in such special situation. But in this kind of mode, liquidation is not likely to be paused, otherwise the exchange or the counter party will take too much risk. This kind of mode is the protocol's design choice. Disallow/Allow to add margin are both ok. Not bug. Refer to GME news in 2021, robinhood announced a "reduce-only" mode. |
Robin hood example don't apply here. In Unstoppable when the adding margin is paused, it is paused across all the assets in the system. Not a single asset can be moved into reduce-only state. So the impact of such behavior is is different and greater than the robin hood example. Case mentioned in original escalation still stays. |
My point of the robinhood example is, there exists precedent of similar protection mode. Here Unstoppable team's setup might be too defensive for many people. But pause mode is common in DeFi, it's just a matter of the degree. Some protocol might pause everything, even more strict. So I think this is design choice, not bug. The suggestion might help the team to deliever a smoother user experience though. |
Result:
|
Escalations have been resolved successfully! Escalation status:
|
BugBusters
high
User can be liquidated while fund_account is paused
Summary
User can be unfairly liquidated while adding margin is paused.
Vulnerability Detail
The function
fund_account
orfund_account_eth
can be paused while the functionliquidate
can never be paused which means user can be unfailry liquidated when adding margin to position is paused since account cannot be funded, which could have saved the user position from liquidating, but in pause scenario user will be liquidated.So for above code snippets following scenerio can play out:
Impact
User is unfailry liqudiated.
Code Snippet
https://github.com/sherlock-audit/2023-06-unstoppable/blob/94a68e49971bc6942c75da76720f7170d46c0150/unstoppable-dex-audit/contracts/margin-dex/Vault.vy#L659-L668
https://github.com/sherlock-audit/2023-06-unstoppable/blob/94a68e49971bc6942c75da76720f7170d46c0150/unstoppable-dex-audit/contracts/margin-dex/Vault.vy#L346-L375
For more reference read the following:
https://dacian.me/defi-slippage-attacks
Tool used
Manual Review
Recommendation
Pause the liquidation mechanism too when funding is paused.
The text was updated successfully, but these errors were encountered: