58736 sc high missing tvl accounting in forcerepay and doliquidation leads to protocol insolvency

Submitted on Nov 4th 2025 at 10:33:19 UTC by @dray for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58736

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/AlchemistV3.sol

  • Impacts:

    • Protocol insolvency

Description

Brief/Intro

The _forceRepay and _doLiquidation functions in AlchemistV3.sol transfer MYT shares out of the contract during liquidations but fail to update the global _mytSharesDeposited counter that tracks total value locked (TVL). This accounting omission causes the protocol's internal TVL to permanently diverge from actual on-chain balances, creating phantom collateral that doesn't exist. Over time, as liquidations accumulate, the protocol becomes insolvent—unable to fulfill all legitimate withdrawal and redemption claims despite appearing healthy in its accounting. This silent deterioration eventually leads to failed withdrawals for later users and deposit-cap denial-of-service as the inflated TVL fills the deposit cap with non-existent collateral.

Vulnerability Details

Root Cause

The protocol maintains a critical state variable _mytSharesDeposited that tracks the total MYT shares held by the Alchemist contract:

// Line 134
uint256 private _mytSharesDeposited;

This variable is used to calculate the protocol's total TVL:

The variable is correctly updated in most operations:

  • Incremented on deposits (line 383)

  • Decremented on withdrawals (line 410)

  • Decremented on burn operations for protocol fees (lines 485, 541)

  • Decremented on redemptions (line 638)

However, two critical liquidation paths fail to decrement this counter when transferring shares out:

Vulnerable Path 1: _forceRepay

In AlchemistV3.sol lines 738-780, when forced repayment occurs:

The Bug: While creditToYield shares are transferred to the transmuter (line 778) and potentially protocolFeeTotal shares to the fee receiver (line 775), _mytSharesDeposited is never decremented. The contract balance decreases, but the internal accounting remains unchanged.

Vulnerable Path 2: _doLiquidation

Similarly, in _doLiquidation at lines 843-890:

Impact Details

###1. Direct Protocol Insolvency: Where the TVL drift creates a scenario where the protocol cannot honor all user claims.

2. Collateralization Ratio Manipulation

References

Primary Issues:

TVL State Variable:

Proof of Concept

Proof of Concept

Was this helpful?