The swap amounts calculated in processDepositFailure() to repay borrowed assets do not validate the amounts are sufficient after accounting for swap slippage.This can cause the contract to become undercollateralized if the swap amounts are too low due to incorrect slippage calculations or unfavorable market movements, and the contract is unable to fully repay debts.
Reproduction Steps:
A deposit is created, borrowing tokens
Deposit fails and processDepositFailure is called
Swap amounts are calculated without checking balance covers repayment
Swap occurs but results in insufficient balance to fully repay
Contract is now undercollateralized
Funds may be permanently lost if GMX liquidates collateral below liabilities.
Contract invariant of being overcollateralized is broken
Manual Review
Validate swap amounts factor in max slippage to always fully cover repayment.
Revert failure handling if swap amounts can't fully repay
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.