57196 sc high artificially inflated mytsharesdeposited in alchemixv3 sol deflates bad debt ratio in transmuter sol

Submitted on Oct 24th 2025 at 09:29:06 UTC by @arturtoros for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #57196

  • 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

Alchemix implemented internal accounting for MYT via _mytSharesDeposited, which is updated on normal deposits/withdrawals. However, when the protocol sends MYT in _forceRepay(), _mytSharesDeposited is not decremented. This artificially inflates the denominator used to compute badDebtRatio in Transmuter.sol, continuously deflating the ratio and allowing bad debt to grow unrecoverably.

Vulnerability Details

You can see an example of how the protocol decreases the variable _mytSharesDeposited in redeem():

TokenUtils.safeTransfer(myt, transmuter, collRedeemed);
TokenUtils.safeTransfer(myt, protocolFeeReceiver, feeCollateral);
_mytSharesDeposited -= collRedeemed + feeCollateral;

However, in _forceRepay(), we are essentialy transfering MYT tokens from the contract to the transmuter and if there is a fee to protocolFeeReceiver but we do not update _mytSharesDeposited.

These inflated _mytSharesDeposited are used in the calculations of badDebtRatio in the denominator in Transmuter.sol:

More specifically, alchemist.getTotalUnderlyingValue() is converting the _mytSharesDeposited to the underlying value.

Impact Details

This issue's impact is not present at the beginning, but is accumulating over time. On each next liquidation, that is liquidating a position with some earmarked debt, and entering the internal function _forceRepay(), it inflates artificially _mytSharesDeposited, which further decreases the badDebtRatio in the Transmuter.sol.

At the beginning, it would not matter that much. However, after some time passes and the more the bad debt ratio is deflated, at some point, whenever the correct bad debt ratio is more than 1e18, claiming a redemption should start taking a haircut from the users, so that the debt can clear. The deflated badDebtRatio would show that the debt is less than 1e18, so users would unfairly claim more than they should (they would not start clearing the bad debt), and it even would worsen. The protocol will become insolvent, because the bad debt in the Transmuter cannot be cleared and would even accumulate more and more.

Proof of Concept

Proof of Concept

Please add this test to AlchemistV3.t.sol, and run it using:

forge test --mt testInflated_Myt_Supply -vv

Logs:

We can see that from one single enter in forceRepay, the bad debt ratio is deflated by almost 20 %, which cannot be recovered even by admins actions.

Was this helpful?