Skip to content
Business logic Audit finding Intermediate

Insolvency as `YUSD` will depeg overtime as the redemption fees are disbursed with no collaterals backing them

The redemption function sends the full collateral amount backing a user's YUSD to the user, then takes a fee in YUSD and burns the rest, but the fee tokens are not backed by any remaining collateral. Over time, accumulated fees could deplete the collateral reserves, making YUSD insolvent and causing it to depeg.

0xNForcer Follow with 0xapple, 0xaxaxa and 34 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-04-aegis-op-grant-judging/issues/1

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

0xNForcer, 0xapple, 0xaxaxa, 0xeix, 0xpiken, 0xrex, Asher, Fade, FalseGenius, Kvar, QuillAudits_Team, Ryonen, aslanbek, asui, bigbear1229, farman1094, gesha17, gkrastenov, harry, hildingr, iamandreiski, irorochadere, itsgreg, mahdifa, mgnfy.view, molaratai, moray5554, onthehunt, phoenixv110, s0x0mtee, shealtielanz, silver_eth, t0x1c, turvec, vinica_boy, w33kEd, x0x0

Summary

On the call to approveRedeemRequest() the collateral amount which was used initially to get the yusdAmount in the mint() function, is calculated via the _calculateRedeemMinCollateralAmount().

Here's a run down, please take a good gander.

Solidity

File: AegisMinting.sol

 function approveRedeemRequest(string calldata requestId, uint256 amount) external nonReentrant onlyRole(FUNDS_MANAGER_ROLE) whenRedeemUnpaused {
    RedeemRequest storage request = _redeemRequests[keccak256(abi.encode(requestId))];
    if (request.timestamp == 0 || request.status != RedeemRequestStatus.PENDING) {
      revert InvalidRedeemRequest();
    }
    if (amount == 0 || amount > request.order.collateralAmount) {
      revert InvalidAmount();
    }

    uint256 collateralAmount = _calculateRedeemMinCollateralAmount(request.order.collateralAsset, amount, request.order.yusdAmount);
//code snip ... some checks.
    uint256 availableAssetFunds = _untrackedAvailableAssetBalance(request.order.collateralAsset);
    if (availableAssetFunds < collateralAmount) {
      revert NotEnoughFunds();
    }

    // Take a fee, if it's applicable
    // @audit  fee amount is taken without accounting for the collateral backing thereby leading to a depegging of the YUSD
    (uint256 burnAmount, uint256 fee) = _calculateInsuranceFundFeeFromAmount(request.order.yusdAmount, redeemFeeBP);
    if (fee > 0) {
      yusd.safeTransfer(insuranceFundAddress, fee);
    }

    request.status = RedeemRequestStatus.APPROVED;
    totalRedeemLockedYUSD -= request.order.yusdAmount;
   //@audit transfers the entire collateral amount to the user.
    IERC20(request.order.collateralAsset).safeTransfer(request.order.userWallet, collateralAmount);
    yusd.burn(burnAmount);

    emit ApproveRedeemRequest(requestId, _msgSender(), request.order.userWallet, request.order.collateralAsset, collateralAmount, burnAmount, fee);
  }

The issue is simply, it sends the entire collateral amount backing the given yusdAmount to the user, the takes a fee out of the yusdAmount and burns the rest, but given fees left aren't backed by any collateral the fee are worthless but would still be redeemable for any of the collateral assets in the contract thereby causing negative yield for the protocol. As fees accumulate, as seen in the code the fees can even rise to 50% it faster the higher the redemption fees are and are accumulated.

Severity Justification.

  • While this might at first not seem like a big deal anyone understanding the dynamics of the protocol would see that over time, the stables backing the YUSD will be depeleted causing the price of YUSD to crash make the contracts insolvent.

Mitigation

The collateral amount to be sent back to the user should be the equivalence in value of the the yusd to be burnt on the call to approveRedeemRequest() The code snippet should be changed as follows.

Diff
function approveRedeemRequest(string calldata requestId, uint256 amount) external nonReentrant onlyRole(FUNDS_MANAGER_ROLE) whenRedeemUnpaused {
   RedeemRequest storage request = _redeemRequests[keccak256(abi.encode(requestId))];
   if (request.timestamp == 0 || request.status != RedeemRequestStatus.PENDING) {
     revert InvalidRedeemRequest();
   }
   if (amount == 0 || amount > request.order.collateralAmount) {
     revert InvalidAmount();
   }
++   // Take a fee, if it's applicable
++  (uint256 burnAmount, uint256 fee) = _calculateInsuranceFundFeeFromAmount(request.order.yusdAmount, redeemFeeBP);
++  if (fee > 0) {
++  yusd.safeTransfer(insuranceFundAddress, fee);
++    }

--  uint256 collateralAmount = _calculateRedeemMinCollateralAmount(request.order.collateralAsset, amount, request.order.yusdAmount);
++  uint256 collateralAmount = _calculateRedeemMinCollateralAmount(request.order.collateralAsset, amount, burnAmount);
   /*
    * Reject if:
    * - asset is no longer supported
    * - smallest amount is less than order minAmount
    * - order expired
    */
   if (
     !_supportedAssets.contains(request.order.collateralAsset) ||
     collateralAmount < request.order.slippageAdjustedAmount ||
     request.order.expiry < block.timestamp
   ) {
     _rejectRedeemRequest(requestId, request);
     return;
   }

   uint256 availableAssetFunds = _untrackedAvailableAssetBalance(request.order.collateralAsset);
   if (availableAssetFunds < collateralAmount) {
     revert NotEnoughFunds();
   }

--  // Take a fee, if it's applicable
--  (uint256 burnAmount, uint256 fee) = _calculateInsuranceFundFeeFromAmount(request.order.yusdAmount, redeemFeeBP);
--  if (fee > 0) {
--    yusd.safeTransfer(insuranceFundAddress, fee);
--  }

   request.status = RedeemRequestStatus.APPROVED;
   totalRedeemLockedYUSD -= request.order.yusdAmount;

   IERC20(request.order.collateralAsset).safeTransfer(request.order.userWallet, collateralAmount);
   yusd.burn(burnAmount);

   emit ApproveRedeemRequest(requestId, _msgSender(), request.order.userWallet, request.order.collateralAsset, collateralAmount, burnAmount, fee);
 }

The original report as published on Sherlock, by 0xNForcer. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the redemption logic calculates the collateral to return based on the full YUSD amount before deducting the fee, so the fee YUSD remains unbacked.

Impact

As fees accumulate, the collateral backing YUSD could be depleted, causing YUSD to depeg and the contract to become insolvent.

What the attacker needed

Redemption fees are enabled; fees accumulate over time

The fix

The collateral amount sent to the user should be calculated based on the YUSD amount to be burned after deducting the fee, not the full YUSD amount.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

YUSD is a stablecoin that should be backed by collateral (like other stablecoins). When someone redeems YUSD, the contract gives them collateral and keeps a fee in YUSD. But that fee YUSD has no collateral behind it, so if it is later redeemed, it takes collateral from other users, slowly draining the reserves and making YUSD worthless.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Aegis.im YUSD

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.