Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 2.37 KB

041.md

File metadata and controls

30 lines (21 loc) · 2.37 KB

Obedient Lava Monkey

Medium

Incorrect adjustment of outstandingDebt in GHO repayment logic leads to protocol accounting inaccuracies.

Summary:

Inaccurate subtraction of the accrued interest (accruedInterest - actualDebtToLiquidate) from outstandingDebt in _burnDebtTokens will cause accounting errors for the protocol, as the remaining bad debt is miscalculated. This occurs when the actualDebtToLiquidate is less than the accrued interest during a liquidation involving GHO.

Root Cause:

In _burnDebtTokens, specifically [line where subtraction occurs], outstandingDebt -= amountToBurn is misapplied, causing inaccurate bad debt tracking. The root cause of the bug lies in the miscalculation of outstandingDebt during GHO liquidation. Specifically, when the accrued interest (accruedInterest) exceeds the amount being repaid (actualDebtToLiquidate), the code subtracts the difference (amountToBurn) from outstandingDebt. This logic fails to account for scenarios where the residual interest should not affect the tracked bad debt, resulting in inaccurate deficit accounting. The protocol's bad debt metrics become unreliable, potentially misallocating resources for recovery or treasury management.

Internal Pre-conditions:

  1. User has an outstanding GHO debt and accrued interest.
  2. Liquidation partially covers the debt but leaves residual interest greater than the debt repaid.

External Pre-conditions:

  1. GHO asset configuration must permit liquidation under the existing conditions.
  2. Liquidation thresholds and health factors trigger the liquidation.

Attack Path:

  1. Liquidator initiates a liquidation call.
  2. Partial repayment leads to execution of _burnDebtTokens.
  3. The subtraction misapplies the interest adjustment, inflating or deflating outstandingDebt.

Impact:

The protocol suffers inaccurate bad debt tracking, affecting deficit recovery and potentially misallocating treasury resources.

Mitigation:

Update the logic in _burnDebtTokens to properly account for remaining interest and ensure outstandingDebt reflects the correct post-liquidation balance.