58116 sc high tvl accounting mismatch leading to protocol insolvency

Submitted on Oct 30th 2025 at 18:37:22 UTC by @vah_13 for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58116

  • 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

AlchemistV3 fails to decrement the internal _mytSharesDeposited accounting variable when transferring MYT tokens out during forced repayments (_forceRepay) and liquidations (_doLiquidation). This causes getTotalUnderlyingValue() to return overstated TVL values, leading to incorrect collateralization calculations, under-liquidations, bad debt accumulation, and potential protocol insolvency.

Vulnerability Details

Root Cause

The contract maintains an internal accounting variable _mytSharesDeposited to track total MYT shares deposited:

// AlchemistV3.sol
uint256 private _mytSharesDeposited;

function _getTotalUnderlyingValue() internal view returns (uint256) {
    return IVaultV2(myt).convertToAssets(_mytSharesDeposited);
}

This variable is correctly incremented in deposit() (line 368) and decremented in withdraw() (line 403). However, when MYT tokens are forcibly transferred out in two critical paths, the accounting is not updated:

Location 1: _forceRepay() at line 779

Location 2: _doLiquidation() at lines 875, 879

Proof of Concept

Proof of Concept

Was this helpful?