A critical vulnerability exists in the settle function due to a hardcoded initialCollateralDeltaAmount value set to 1. This prevents complete withdrawal of user collateral from positions, leading to partial funds being permanently stuck in protocol contracts or exposed to liquidation risks. The flaw systematically jeopardizes user assets and violates core custodial obligations.
Non-adaptive Withdrawal Logic:
The initialCollateralDeltaAmount parameter is fixed at 1, regardless of the actual collateral amount in the position. This violates the fundamental requirement of full collateral withdrawal during settlement.
Position Data Ignorance:
The function fails to query the current collateral amount via GMX's getPositionInfo before creating orders, using a static value instead.
Multi-Transaction Burden:
To withdraw full collateral (N units), users must manually call settle() N times - an impractical expectation leading to guaranteed partial losses.
Position Creation:
User deposits 100 ETH as collateral for a $1M position.
Settlement Trigger:
Protocol calls settle(), setting initialCollateralDeltaAmount=1.
Incomplete Withdrawal:
Only 1 ETH is withdrawn. Remaining 99 ETH:
If left in contract: Earns no yield and becomes inaccessible.
If market crashes: Gets liquidated, causing total loss.
Required Manual Intervention:
User must detect the issue and call settle() 99 more times (improbable in practice).
Direct Fund Loss: Unwithdrawn collateral exposed to liquidation.
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.