56815 sc high missing mytsharesdeposited decrements in internal outflows cause tvl inflation deposit dos

Submitted on Oct 20th 2025 at 21:37:36 UTC by @ihtishamsudo for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #56815

  • Report Type: Smart Contract

  • Report severity: High

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

  • Impacts:

    • Smart contract unable to operate due to lack of token funds

Description

Brief/Intro

Alchemist V3 broken internal accounting fails to decrement _mytSharesDeposited when MYT (yield token) is transferred out during force-repay and liquidation operations. it causes the (TVL) calculation to become inflated relative to the actual MYT balance held by the contract (demonstrated in poc below)

Vulnerability Details

The AlchemistV3 contract maintains a private state variable _mytSharesDeposited to track the total MYT shares deposited into the protocol. This value is used in two functions:

  1. _getTotalUnderlyingValue() - Converts _mytSharesDeposited to underlying value for TVL calculations

  2. deposit() - Enforces the deposit cap: _checkState(_mytSharesDeposited + amount <= depositCap)

_mytSharesDeposited is correctly incremented on deposits and correctly decremented on user-initiated withdrawals, repayments with fees, and redemptions. However, it is nott decremented during internal MYT outflows in two paths:

Impact Details

Since the deposit() function enforces a cap check using the inflated _mytSharesDeposited value, legitimate users are permanently blocked from depositing once the discrepancy grows large enough, even when the actual token balance is well below the configured depositCap.

References

https://github.com/alchemix-finance/v3-poc/blob/b2e2aba046c36ff5e1db6f40f399e93cd2bdaad0/src/AlchemistV3.sol#L738 https://github.com/alchemix-finance/v3-poc/blob/b2e2aba046c36ff5e1db6f40f399e93cd2bdaad0/src/AlchemistV3.sol#L852

Proof of Concept

Proof of Concept

Here's what i cooked:

  • Test Logs

Was this helpful?