57441 sc critical repay only fee drain in alchemistv3

Submitted on Oct 26th 2025 at 09:20:18 UTC by @KiLl3rX for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #57441

  • Report Type: Smart Contract

  • Report severity: Critical

  • 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

A vulnerability in the AlchemistV3 contract enables an external liquidator to exploit the payment-only path during a liquidation, causing a depletion of the protocol's funds. If exploited on the mainnet, the liquidator could receive more funds than the target by depleting the protocol's MYT balance. This issue occurs because the payment-only path allows the liquidator to receive the full theoretical payment fee, not the actual fee deducted from the user's collateral, with the difference being covered by the protocol itself.

Vulnerability Details

Offer a detailed explanation of the vulnerability itself. Do not leave out any relevant information. Code snippets should be supplied whenever helpful, as long as they don’t overcrowd the report with unnecessary details. This section should make it obvious that you understand exactly what you’re talking about, and more importantly, it should be clear by this point that the vulnerability does exist.

##Details

In the AlchemistV3 contract, specifically in the liquidate() function and the _resolveRepaymentFee() helper function, the repayment fee is calculated based on the theoretical value but deducted based on the available collateral. The issue arises because _resolveRepaymentFee() returns the theoretical fee rather than the actual fee that has been deducted from the collateral. This allows the liquidator to receive the full theoretical fee, with the difference being drained from the protocol's MYT balance. Below are the relevant code snippets:

And in the liquidate() function:

In the repay-only path, this mismatch between the theoretical and actual fee results in the protocol losing funds when the liquidator is paid the full fee, regardless of the collateral available.

Impact Details

Provide a detailed breakdown of possible losses from an exploit, especially if there are funds at risk. This illustrates the severity of the vulnerability, but it also provides the best possible case for you to be paid the correct amount. Make sure the selected impact is within the program’s list of in-scope impacts and matches the impact you selected.

Proof of Concept

Proof of Concept

forge test --match-path test/poc.t.sol -vvv

Was this helpful?