Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 2.21 KB

File metadata and controls

61 lines (38 loc) · 2.21 KB

Raspy Black Giraffe

High

The incorrect condition in liquidity checks will allow liquidity rule bypass for increasing taker orders

Summary

A missing conditional check in liquidityChecks() will cause a bypass of liquidity rules for increasing taker orders as the function improperly applies liquidity checks under unintended scenarios. This inconsistency could lead to systemic risks in market stability

Root Cause

Root Cause

In liquidityChecks() the condition :

return !marketParameter.closed &&  
    ((long(self).isZero() && short(self).isZero()) || increasesTaker(self));

includes increasesTaker(self) as a condition under which liquidity checks apply. This contradicts the intended behavior stated in the comment, which implies liquidity checks should not apply to increasing taker orders.

Internal Pre-conditions

  1. The market must be open
  2. The order must either have no position changes (long(self).isZero() && short(self).isZero() == true) or be an increasing taker order (increasesTaker(self) == true).

External Pre-conditions

No response

Attack Path

  1. A user submits an increasing taker order.
  2. The liquidityChecks() function evaluates the order.
  3. Liquidity checks improperly apply (or fail to bypass) due to the inclusion of increasesTaker(self) in the condition.

Impact

The protocol may allow invalid orders to bypass liquidity rules incorrectly. This could lead to:

  1. Collateral underfunding for increasing taker orders.
  2. Systemic risk of market destabilization due to insufficient liquidity enforcement.

Potential Loss: This depends on the volume and leverage of increasing taker orders. In a worst-case scenario, it could result in cascading liquidation events or insolvency.

PoC

No response

Mitigation

To resolve this issue, revise the condition in liquidityChecks() to ensure increasing taker orders bypass liquidity checks when appropriate. For example:

return !marketParameter.closed &&  
    ((long(self).isZero() && short(self).isZero()) || !increasesTaker(self));