The stability mechanism contains a critical flaw where swap fulfillment calculations use outdated vault debt values, enabling improper asset transfers. The root cause is the missing synchronization between debt state updates (Vault.recalculateVaultsCreditCapacity
) and swap execution (StabilityBranch.fulfillSwap
). This allows swaps to be processed with stale debt ratios, corrupting the premium/discount calculations that determine USDz redemption rates. The protocol faces direct financial leakage risks as users could receive incorrect asset amounts during debt state transitions, potentially leading to protocol insolvency if exploited during market stress conditions.
The vulnerability stems from using stale debt values during swap fulfillment calculations in the stability mechanism. The critical issue occurs in StabilityBranch.fulfillSwap
where asset transfers are calculated using potentially outdated debt values from the vault:
The calculation flow:
1.StabilityBranch.getAmountOfAssetOut
uses Vault.getTotalDebt
:
2.Vault.getTotalDebt
aggregates the storage states:
marketsRealizedDebtUsd
depositedUsdc
marketsUnrealizedDebtUsd
3.These debt values are only updated in Vault.recalculateVaultsCreditCapacity
:
4.The swap execution path lacks a call to update these debt values before using them for premium/discount calculations
This creates a race condition where:
Debt values become stale between market state changes and swap executions
Premium/discount factors applied to swaps are calculated using outdated financial data
Asset transfers could over-compensate users or under-protect protocol reserves
The vulnerability is particularly dangerous during periods of high volatility or frequent market operations, where debt values might change significantly between recalculations.
The stale debt calculation vulnerability creates critical financial risks for the protocol:
Inaccurate Premium/Discount Application
Outdated debt values lead to incorrect premium/discount factors in swap rate calculations
Users could receive up to 100% of asset value during protocol insolvency states
Protocol might over-pay during premium phases (user profit) or under-pay during discount phases (protocol profit)
Arbitrage Opportunities
Sophisticated actors could front-run recalculations to exploit stale pricing
Creates risk-free profit opportunities at protocol expense during debt state transitions
Protocol Insolvency Risk
If unrealized debt grows without recalculation:
Swaps could drain collateral reserves beyond sustainable levels
Vaults might become undercollateralized without proper accounting
Systemic Pricing Inaccuracy
All USDz swaps would reference outdated debt ratios
Destabilizes the protocol's core stability mechanism
Compromises the 1:1 USDz peg maintenance capability
The combination of these factors creates a high-severity risk of direct financial losses and protocol insolvency, particularly during periods of market stress or high swap volume.
Manual Review
Implement debt state synchronization before swap processing by adding the recalculation hook:
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.