58606 sc high missing collateral accounting in liquidation leads to inflated bad debt calculations

#58606 [SC-High] Missing collateral accounting in liquidation leads to inflated bad debt calculations

Submitted on Nov 3rd 2025 at 14:13:42 UTC by @dobrevaleri for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58606

  • 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

During liquidations in AlchemistV3::liquidate(), yield tokens transferred to the transmuter and liquidator fees are not properly accounted for in the _mytSharesDeposited tracking variable. This creates a discrepancy between the actual and reported total underlying value, leading to incorrect bad debt ratio calculations that affect the transmuter's loss distribution mechanism.

Vulnerability Details

The root cause lies in the inconsistent accounting of collateral balance changes in the AlchemistV3::liquidate() function. When examining other functions that modify user collateral balances, such as repay() and burn(), we observe proper accounting:

In AlchemistV3::burn():

In AlchemistV3::repay():

However, in the liquidate() and batchLiquidate() functions, there is no corresponding adjustment to _mytSharesDeposited.

The _mytSharesDeposited variable is used in _getTotalUnderlyingValue() to calculate the system's total collateral value:

This inflated total collateral value is then used by the transmuter to calculate the bad debt ratio in Transmuter::claimRedemption():

Impact Details

The _getTotalUnderlyingValue() function returns values higher than the actual collateral remaining in the system. The transmuter calculates badDebtRatio = totalSyntheticsIssued / totalUnderlyingValue, where an inflated denominator results in artificially low bad debt ratios

When the system experiences bad debt (ratio > 1e18), the transmuter should scale down redemptions proportionally. However, due to underreported bad debt ratios, this mechanism fails to trigger. Early redeemers receive full payouts while later redeemers bear disproportionate losses when the alchemist reserves are depleted or will be unable to claim their redemptions due to lack of funds

References

AlchemistV3::repay(): https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L541

AlchemistV3::burn(): https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/AlchemistV3.sol#L485

Transmuter::claimRedemption(): https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/Transmuter.sol#L217-L226

Proof of Concept

Proof of Concept

Was this helpful?