You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crazy Cyan Worm - Missing collateral health checks in LeverageManager.withdrawAssets will cause bad debt accumulation as users withdraw below liquidation thresholds
#559
Missing collateral health checks in LeverageManager.withdrawAssets will cause bad debt accumulation as users withdraw below liquidation thresholds
Summary
The lack of post-withdrawal collateral validation in LeverageManager.withdrawAssets will lead to protocol insolvency as attackers withdraw collateral from positions with insufficient safety margins. This allows strategic removal of collateral assets even when positions are near liquidation levels, creating systemic undercollateralization that liquidation mechanisms cannot resolve, ultimately resulting in unrecoverable lender funds.
Root Cause
In function LeverageManager.withdrawAssets(LeverageManager.sol#L199-L204) the withdrawal function lacks collateral health validation before allowing asset removal. The withdrawAssets function calls LeveragePositionCustodian.withdraw which transfers collateral tokens without checking if the position remains sufficiently collateralized after withdrawal. This allows position owners to drain collateral even when their debt-to-collateral ratio exceeds safe thresholds, bypassing liquidation protections.
The missing health factor check creates a protocol-level vulnerability where undercollateralized positions could accumulate bad debt that cannot be liquidated. Proper lending protocols should validate collateral ratios remain above liquidation thresholds during any asset removal operations.
Internal Pre-conditions
Protocol allows direct collateral withdrawals without checking debt-to-collateral ratios
Leveraged positions maintain debt obligations separate from collateral tracking
No minimum collateral threshold enforcement during asset removal operations
External Pre-conditions
Existence of leveraged positions with collateral value barely above liquidation thresholds
Market conditions where collateral assets experience price volatility (e.g. ETH drops 5% daily)
Custodian contracts hold sufficient liquid collateral assets (e.g. $500k USDC in custody)
Attack Path
Attacker opens leveraged position with $100k collateral supporting $80k debt (125% collateral ratio)
Market dip reduces collateral value to $85k (106% ratio, near 100% liquidation threshold)
Attacker withdraws $10k collateral via withdrawAssets without repayment
Position collateral drops to $75k against $80k debt (93% ratio - undercollateralized)
Protocol liquidation mechanisms fail to recover full debt due to insufficient collateral
Repeat across multiple positions to create systemic undercollateralization
Impact
Protocol lenders face direct financial loss from unrecoverable debt. For example:
Total protocol TVL: $10M with $8M borrowed
Attacker drains 15% collateral ($1.5M) from leveraged positions
Creates $1.2M bad debt (15% of $8M loans) that cannot be liquidated
Crazy Cyan Worm
High
Missing collateral health checks in
LeverageManager.withdrawAssets
will cause bad debt accumulation as users withdraw below liquidation thresholdsSummary
The lack of post-withdrawal collateral validation in
LeverageManager.withdrawAssets
will lead to protocol insolvency as attackers withdraw collateral from positions with insufficient safety margins. This allows strategic removal of collateral assets even when positions are near liquidation levels, creating systemic undercollateralization that liquidation mechanisms cannot resolve, ultimately resulting in unrecoverable lender funds.Root Cause
In function
LeverageManager.withdrawAssets
(LeverageManager.sol#L199-L204
) the withdrawal function lacks collateral health validation before allowing asset removal. ThewithdrawAssets
function callsLeveragePositionCustodian.withdraw
which transfers collateral tokens without checking if the position remains sufficiently collateralized after withdrawal. This allows position owners to drain collateral even when their debt-to-collateral ratio exceeds safe thresholds, bypassing liquidation protections.The missing health factor check creates a protocol-level vulnerability where undercollateralized positions could accumulate bad debt that cannot be liquidated. Proper lending protocols should validate collateral ratios remain above liquidation thresholds during any asset removal operations.
Internal Pre-conditions
External Pre-conditions
Attack Path
withdrawAssets
without repaymentImpact
Protocol lenders face direct financial loss from unrecoverable debt. For example:
PoC
No response
Mitigation
Implement collateral health checks before allowing withdrawals:
LeverageManager.withdrawAssets
Example modification flow:
The text was updated successfully, but these errors were encountered: