Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
The AlchemistV3::redeem() function contains a logic flaw in how redemption fees are deducted and synchronized. Specifically, feeCollateral is subtracted directly from _mytSharesDeposited during redemption, expect to perform deduction via _collateralWeight when synchronizing. This design can lead to situations where a user’s redemption unintentionally causes contract's collateral to be reduced—especially during periods of sharp price fluctuation.
Vulnerability Details
The redeem() function in AlchemistV3 is called by the Transmuter contract to process a redeemer’s request to convert myt tokens. However, the redemption fee (feeCollateral) is deducted directly from _mytSharesDeposited (@>1), assuming the subsequent _sync() call will later update borrower account’s collateral balance using _collateralWeight (@>2).
// AlchemistV3::redeem()functionredeem(uint256amount)externalonlyTransmuter{_earmark(); // SNIP... // move only the net collateral + fee@>uint256collRedeemed=convertDebtTokensToYield(amount);@>uint256feeCollateral=collRedeemed*protocolFee/BPS;@>uint256totalOut=collRedeemed+feeCollateral; // update locked collateral + collateral weightuint256old=_totalLocked;@>_totalLocked=totalOut>old?0:old-totalOut;@>1_collateralWeight+=PositionDecay.WeightIncrement(totalOut>old?old:totalOut,old);@>TokenUtils.safeTransfer(myt,transmuter,collRedeemed);@>TokenUtils.safeTransfer(myt,protocolFeeReceiver,feeCollateral);@>1_mytSharesDeposited-=collRedeemed+feeCollateral;emitRedemption(redeemedDebtTotal);}
However, if there is significant price volatility during the redemption process, the borrower's collateral balance may be insufficient to cover the deducted collateral. In this case, the shortfall will be borne by other users, preventing them from making proper withdrawals:
Thus, the deduction model mixes user-level and system-level accounting, creating potential cross-account contamination when redemption fees are calculated under volatile market conditions.
Impact Details
Collateral Misallocation: When the redeeming user’s collateral is insufficient, feeCollateral is effectively sourced from the collective pool, unintentionally reducing other users’ collateral balances.
Incorrect Fee Attribution: The protocol fee intended to be covered by the redeemer may instead be paid indirectly by other depositors, leading to unfair loss distribution.
Potential Insolvency Risk: Over time, repeated redemptions during volatile conditions could cause discrepancies between reported and actual collateral values, increasing the risk of protocol under-collateralization.