When a liquidation involves only earmarked debt repayment (without further liquidation), the protocol pays the liquidator a repayment fee calculated as fee = repaidAmount * repaymentFee / BPS. However, the fee is transferred unconditionally from the contract's pooled collateral, while the victim's account is only debited by min(fee, account.collateralBalance).
If the account lacks sufficient collateral to cover the fee, the shortfall is implicitly socialized across all depositors' pooled collateral, resulting in:
Direct theft of user funds from the shared collateral pool
Silent value leakage to liquidators beyond what was deducted from the liquidated account
Accounting mismatch between events logged and actual state changes
Vulnerability Details
Affected Components
Contract: src/AlchemistV3.sol
Functions:
_resolveRepaymentFee() (lines 903-909) - calculates fee, debits only min(fee, balance)
_liquidate() (lines 793-850) - transfers full feeInYield to liquidator unconditionally
Root Cause
The vulnerability stems from a mismatch between fee deduction and fee payout: