AlchemistV3._resolveRepaymentFee deducts the repayment fee from a borrower’s collateral and pays it to the liquidator, but _mytSharesDeposited is never decremented. In the liquidation branch that only repays earmarked debt, the fee leaves the contract while system TVL still counts it. Repeating this drains real collateral and lets the protocol burn alAssets against phantom backing until it becomes insolvent.
Vulnerability Details
When _liquidate only needs to clear earmarked debt, it executes:
Immediately after, _liquidate transfers the fee out of the contract (src/AlchemistV3.sol:825-826). _mytSharesDeposited is never reduced, so _getTotalUnderlyingValue() (src/AlchemistV3.sol:1236-1241) still includes the missing amount. Transmuter bad-debt scaling (src/Transmuter.sol:215-226) and collateralization checks now rely on phantom collateral.
Impact Details
Each liquidation that repays earmarked debt overstates _mytSharesDeposited by repaidAmountInYield * repaymentFee / BPS.
The protocol keeps redeeming alAssets and issuing new debt against nonexistent backing, leading to permanent bad debt.
With any non-zero repaymentFee, an attacker can farm this branch, extract fees, and quietly erode actual collateral until insolvency.
Fee transfer to liquidator: src/AlchemistV3.sol:825-826
TVL calculation from _mytSharesDeposited: src/AlchemistV3.sol:1236-1241
Bad-debt ratio using inflated denominator: src/Transmuter.sol:215-226
Proof of Concept
Set repaymentFee to a positive value (e.g., 5%) and keep protocol fee at 0 to isolate the effect.
Borrower deposits MYT, mints debt; another user creates a transmuter redemption to earmark half the debt.
After maturity, liquidator calls alchemist.liquidate(tokenId). _forceRepay clears the debt and _resolveRepaymentFee pays the fee; _liquidate returns early.
Compare alchemist.getTotalUnderlyingValue() with convertYieldTokensToUnderlying(IERC20(vault).balanceOf(address(alchemist))): the difference equals the repayment fee, proving _mytSharesDeposited still counts the exited funds.