Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Market and Settlement Disabled Check Allows Certain Invalid Trades

Summary

The createMarketOrder function only checks if the market and settlement are enabled when increasing a position. However, it does not explicitly check whether closing or reducing a position should be restricted when the market or settlement is disabled. This could allow traders to close or reduce positions in a market that should be completely disabled.

Vulnerability Details

  • Disable a market using the relevant configuration (perpsEngineConfiguration.chechMarketIsEnabled(params.marketId);).

  • Try to close a position by placing a market order with a sizeDelta that reduces the existing position.

  • The function will allow the trade bypassing the disabled market restriction because it only checks when ctx.isNotionalValueIncreasing is true

  • The position is closed despite the market being disabled, which violates the intended behavior of disabling the market entirely.

Impact

  • If a market is disabled users should not be able to trade at all, including closing or reducing their positions.

  • Allowing position reductions when a market is disabled could lead to inconsistent system states, unfair advantages for certain traders, and potential arbitrage opportunities.

  • If settlement is disabled, closing positions might leave the contract in an unsettled state, leading to funds mismanagement or incorrect balances.

Tools Used

Manual Review

Recommendations

  • Modify the logic to explicitly check whether closing a position should also be prevented when the market or settlement is disabed.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Appeal created

olami9783 Submitter
7 months ago
inallhonesty Lead Judge
6 months ago
inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.