A vulnerability has been identified in the GMX protocol's position management system where both
_createIncreasePosition
and _createDecreasePosition
functions lack proper slippage protection. This is due to the
minOutputAmount
parameter being set to zero, which could lead to substantial losses for users during volatile market
conditions.
it's crucial to implement a non-zero minOutputAmount that guarantees users receive at least a certain percentage of their
input, thereby safeguarding against adverse market conditions.
_createIncreasePosition()
:
_createDecreasePosition()
:
The GMX protocol uses a keeper system for executing position changes. When users request position modifications, these
requests are queued and later executed by keepers. The time delay between request submission and execution makes proper
slippage protection crucial.
Key Issues:
Zero minOutputAmount
means no minimum guarantee for position size
Users could receive significantly smaller positions than expected
No protection against price manipulation during the keeper execution delay
Key Issues:
Zero minOutputAmount
means no minimum guarantee for withdrawal amount
Users could receive significantly less collateral than expected
Particularly dangerous during market volatility or low liquidity conditions
Likelihood: High (Every position creation/modification is affected)
Impact: Medium (Financial losses possible but limited by market conditions)
Volatile Market Scenario
Position Increase Risk:
Potential loss: (Expected Position Size - Actual Position Size)
Risk factors: Market volatility, keeper delay, gas prices
Position Decrease Risk:
Potential loss: (Expected Collateral - Actual Collateral Received)
Risk factors: Market manipulation, slippage, liquidity conditions
Add Constants:
Add Events:
Add Position Creation Safeguards:
Unit Tests:
Implementing proper slippage protection is crucial for the GMX protocol's position management system. The recommended
changes will significantly improve user protection against adverse market conditions and potential manipulation. Regular
monitoring and adjustments to slippage parameters may be necessary based on market conditions.
acceptablePrice does that job for increase/decrease positions. https://github.com/gmx-io/gmx-synthetics/blob/caf3dd8b51ad9ad27b0a399f668e3016fd2c14df/contracts/order/BaseOrderUtils.sol#L276C49-L276C66
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.