56824 sc high missing update to mytsharesdeposited during liquidation
Submitted on Oct 21st 2025 at 00:42:56 UTC by @Josh4324 for Audit Comp | Alchemix V3
Report ID: #56824
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
The _mytSharesDeposited variable serves as an aggregate counter for all MYT shares held by the contract on behalf of users. It is incremented during deposits and decremented in scenarios where MYT is transferred out, such as withdrawals, repayments, burns, and redemptions. This ensures that _mytSharesDeposited accurately reflects the contract's MYT balance attributable to user positions.
However, in liquidation related functions specifically _forceRepay and _doLiquidation MYT tokens are transferred to external addresses (e.g., the transmuter, protocol fee receiver, or liquidator) without corresponding decrements to _mytSharesDeposited. This omission causes the variable to become progressively overstated as liquidations occur, leading to discrepancies between the tracked value and the actual MYT balance.
Vulnerability Details
The contract assumes that all MYT outflows are accounted for in primary user-facing functions, but overlooks internal helper functions used in liquidations.
Liquidations involve repaying debt using a position's collateral, which reduces the position's collateralBalance but does not adjust the global _mytSharesDeposited.
In _forceRepay:
In _doLiquidation:
The contract relies on accurate global collateralization ratios for critical decisions, such as in calculateLiquidation. This function computes alchemistCurrentCollateralization as:
Here, an inflated _getTotalUnderlyingValue() (due to overstated _mytSharesDeposited) makes the protocol appear more collateralized than it truly is (e.g., reporting a ratio above globalMinimumCollateralization when it's actually below).
Impact Details
The function _getTotalUnderlyingValue() reports a higher total value than actual, as it relies on the overstated _mytSharesDeposited
Inflated global collateralization ratios mask undercollateralization, delaying or preventing full liquidations. .
Users redeeming via the transmuter may receive less value than expected due to insufficient MYT backing, as the system appears healthier than it is
In stressed scenarios (e.g., market downturns), unchecked bad debt can cause liabilities to exceed assets, making the protocol unable to honor redemptions, repayments, or synthetic burns.
New deposits fail prematurely against the depositCap due to the inflated tracker, reducing liquidity inflows and hindering protocol growth.
Critical checks in calculateLiquidation (e.g., global collateralization) become inaccurate, leading to incomplete liquidations and prolonged exposure to risky positions.
References
https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/AlchemistV3.sol#L549
Proof of Concept
Proof of Concept
Copy test and paste into src/test/AlchemistV3.t.sol Run forge test --mt testLiquidate_Undercollateralized_PositionJosh -vv
Result
Ran 1 test for src/test/AlchemistV3.t.sol:AlchemistV3Test
[PASS] testLiquidate_Undercollateralized_PositionJosh() (gas: 1411926)
Logs:
before 377714825306893295200000
after 377714825306893295200000
Was this helpful?