58207 sc high alchemistv3 mytsharesdeposited not reduced when repaid collateral sent to transmuter

#58207 [SC-High] AlchemistV3 _mytSharesDeposited Not Reduced When Repaid Collateral Sent to Transmuter

Submitted on Oct 31st 2025 at 11:13:50 UTC by @Brainiac5 for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58207

  • Report Type: Smart Contract

  • Report severity: High

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

  • Impacts:

    • Contract fails to deliver promised returns, but doesn't lose value

Description

Bug Report: AlchemistV3 _mytSharesDeposited Not Reduced When Repaid Collateral Sent to Transmuter

Severity

HIGH

Summary

The AlchemistV3._forceRepay() function transfers repaid collateral (MYT tokens) to the transmuter but does not decrement _mytSharesDeposited. This creates a critical accounting mismatch where _mytSharesDeposited shows inflated values compared to actual token balances, incorrectly capping deposits and masking the true protocol state.

Vulnerable Code

Force Repay Transfers Collateral Without Accounting Update

File: src/AlchemistV3.sol

File: src/AlchemistV3.sol

Vulnerability Details

The Accounting Flow

When users deposit MYT:

When force liquidation repays debt:

Impact

Severity Justification

1. Deposit Cap Becomes inconsistent with the true system state

  • If depositCap = 1000e18

  • Real deposits = 800e18 (should allow 200e18 more)

  • But _mytSharesDeposited shows 950e18 due to untracked transfers out

  • Result: Only 50e18 deposits allowed instead of 200e18

Decrement _mytSharesDeposited When Sending to Transmuter

Proof of Concept

Proof of Concept

Test File: (ADD TO) src/test/AlchemistV3.t.sol

Run with:

Was this helpful?