Skip to content
$1,000,000 in security audit grants are live now, Apply here →

Security review · June 2024

Synthetics Updates, June 2024, Part 3

for GMX

GMX engaged Guardian to review the security of updates to it’s synthetic assets exchange. From the 10th of June to the 12th of June, a team of 2 auditors reviewed the source code in scope.

Published
Review window
June 10 to 12, 2024
Language
Solidity
Chains
Arbitrum, Avalanche
Sector
Perpetuals
  • 1 Critical
  • 0 High
  • 0 Medium
  • 0 Low
  • 0 Informational

1 resolved

Scope

Overview

GMX engaged Guardian to review the security of updates to it’s synthetic assets exchange. From the 10th of June to the 12th of June, a team of 2 auditors reviewed the source code in scope.

Findings 1

  1. C-01 Critical Risk Free Trades With cancellationReceiver DoS Resolved
    Location
    OrderUtils.sol: 59, 187

    Description

    In the cancelOrder function if the order is an increase or swap order, which requires input funds, these funds are sent back to the cancellationReceiver. When the cancellationReceiver address is the OrderVault the transferOut function will revert with the SelfTransferNotSupported error.

    As a result a malicious actor may create a MarketIncrease order with the following properties:

    • The cancellationReceiver is the OrderVault
    • The swapPath includes a market that would fail it’s reserves validation as a result of the swap

    The order fails as the initial swap for the increase order cannot go through, but the order cannot be cancelled as the cancellationReceiver is the OrderVault.

    Therefore the order will remain in the OrderStore until the malicious actor sees that price has moved in their favor relative to the range of prices that their MarketIncrease order may be executed with. The malicious actor can then deposit into the market in the swapPath which was previously failing the reserve validation, such that it no longer fails the reserve validation and the order can be executed. The malicious actor then realizes a risk-free profit.

    If price should not move in the actor’s favor during the 5 minute max price age period after their order’s requestExpiration time, then the actor may update their order and attempt the risk free trade over the next period.

    Recommendation

    Upon order creation validate that the cancellationReceiver is not the address of the OrderVault.

    Resolution

    GMX Team: Resolved.

More from GMX

All 44 reports
  1. Timelock Updates

    4 findings 4 findings: 3 low, 1 informational
  2. LayerZeroProvider Routing

    1 finding 1 finding: 1 medium
  3. Open Interest Updates

    5 findings 5 findings: 2 medium, 3 low
  4. Updates Branch

    2 findings 2 findings: 2 low

Put your code through the same review.

This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.

Get a quote