56791 sc high missing mytsharesdeposited decrements in token transfers

Submitted on Oct 20th 2025 at 17:47:43 UTC by @teoslaf1 for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #56791

  • 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

Summary

The _mytSharesDeposited state variable is not decremented when MYT tokens are transferred out of the AlchemistV3 contract during liquidations and force repayments. This causes the Total Value Locked (TVL) to be artificially inflated, leading to incorrect collateralization calculations, deposit cap issues, and bad debt ratio miscalculations.

Vulnerability Details

Root Cause

_mytSharesDeposited tracks the total MYT shares deposited in the contract and is used to calculate TVL:

// Line 1244 in AlchemistV3.sol
function _getTotalUnderlyingValue() internal view returns (uint256 totalUnderlyingValue) {
    uint256 yieldTokenTVLInUnderlying = convertYieldTokensToUnderlying(_mytSharesDeposited);
    totalUnderlyingValue = yieldTokenTVLInUnderlying;
}

However, when tokens are transferred out during liquidations and force repayments, _mytSharesDeposited is not decremented, causing it to diverge from the actual token balance.

Missing Decrements

1. In _doLiquidation() (Lines 880 & 884)

2. In _forceRepay() (Lines 779 & 785)

Impact

Inflated TVL Calculations

  • getTotalUnderlyingValue() returns inflated values

  • Affects all collateralization ratio calculations throughout the protocol

  • System appears healthier than reality

Add _mytSharesDeposited decrements after each token transfer:

Fix for _doLiquidation()

Fix for _forceRepay()

Proof of Concept

Add this to AlchemistV3.t.sol

Was this helpful?