Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: high
Invalid

Undercollateralization due to insufficient swap amounts in processDepositFailure()

Summary

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.

Vulnerability Details

Reproduction Steps:

  1. A deposit is created, borrowing tokens

  2. Deposit fails and processDepositFailure is called

  3. Swap amounts are calculated without checking balance covers repayment

  4. Swap occurs but results in insufficient balance to fully repay

  5. Contract is now undercollateralized

Impact

Funds may be permanently lost if GMX liquidates collateral below liabilities.
Contract invariant of being overcollateralized is broken

Tools Used

Manual Review

Recommendations

Validate swap amounts factor in max slippage to always fully cover repayment.
Revert failure handling if swap amounts can't fully repay

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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