The credit rebalancing mechanism in function CreditDelegationBranch.rebalanceVaultsAssets
commits a fundamental accounting error by using the precomputed depositAmountUsdX18
value rather than the actual return value of executeSwapExactInputSingle
when updating vault debt records. This violates core accounting invariants by:
Ignoring On-Chain Execution Results - The swap's real output (returned as uint256 amountOut
) is discarded in favor of theoretical calculations
Creating Phantom Assets - Vault balances are credited with USDC that never materialized in the protocol's reserves
This enables gradual erosion of protocol solvency as vaults develop increasing discrepancies between reported USDC balances and actual holdings, ultimately risking mass unrecoverable withdrawals when liabilities exceed real assets.
The vulnerability occurs in the credit rebalancing process CreditDelegationBranch.rebalanceVaultsAssets
(CreditDelegationBranch.sol#L663-L666) when converting collateral assets to USDC. The code currently uses the expected swap amount depositAmountUsdX18
rather than the actual received amount from the DEX swap to update vault accounting records. This creates a discrepancy between real asset movements and internal bookkeeping.
This mismatch allows for gradual accumulation of accounting errors due to:
Slippage in DEX swaps
Fee differences between expected and actual rates
Partial fills or failed swaps being treated as successful
The protocol assumes perfect swap execution by using pre-calculated values rather than verifying on-chain results, violating the "checks-effects-interactions" pattern and creating solvency risks.
This accounting mismatch creates systemic risk to protocol solvency through:
Vault Under-collateralization
Persistent negative slippage causes vaults to report more USDC than actually held, creating artificial liquidity that could lead to unrecoverable withdrawals
Protocol-Wide Insolvency Risk
Accumulated discrepancies between real and reported balances may render the system unable to honor redemption requests during market stress
Arbitrage Opportunities
Malicious actors could exploit the slippage gap by frontrunning rebalancing swaps, extracting value from vault inaccuracies
Broken Economic Assumptions
The core credit delegation mechanism becomes unreliable as vault balances diverge from on-chain asset holdings, undermining the entire market-making system's integrity
This constitutes a high-severity vulnerability as it directly impacts the protocol's ability to maintain accurate accounting of user funds - a critical requirement for any DeFi lending/credit system.
Manual Review
Implement the following changes to align accounting with actual swap results:
1.Use Actual Swap Output
Modify CreditDelegationBranch.sol#L663-L666
to:
2.Add Slippage Protection
Implement minimum output checks using oracle prices to prevent unfavorable swaps:
These changes ensure protocol accounting remains grounded in real asset movements while adding critical safeguards against market volatility and execution risks.
he rebalanceVaultsAssets function in CreditDelegationBranch.sol updates vault accounting using the pre-swap USD value (usdDelta) rather than the actual post-swap USDC amount received. This means slippage is not accounted for, causing accounting misalignment - if there's negative slippage, the credit vault gets credited more USDC than actually received; if there's positive slippage, it gets credited less.
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.