The return value of mint is not checked
The strategy contract calls the Moonwell mUSDC mint function but ignores its return value, which signals failure with a non-zero error code instead of reverting. If minting fails silently, the USDC transferred in for allocation can become stuck in the strategy and excluded from the vault's total assets.
- Disclosed after under an hour
56737 sc medium the return value of mint is not checked
Submitted on Oct 20th 2025 at 04:25:20 UTC by @ox9527 for Audit Comp | Alchemix V3
- Report ID: #56737
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/strategies/optimism/MoonwellUSDCStrategy.sol
- Impacts:
- Permanent freezing of funds
Description
Brief/Intro
The MoonwellUSDCStrategy.sol::_allocate() invoke mUSDC::mint() to allocate assets , however the return value of it is not checked
Vulnerability Details
In the MoonwellUSDCStrategy.sol::_allocate()
function _allocate(uint256 amount) internal override returns (uint256) {
require(TokenUtils.safeBalanceOf(address(usdc), address(this)) >= amount, "Strategy balance is less than amount");
TokenUtils.safeApprove(address(usdc), address(mUSDC), amount);
// Mint mUSDC with underlying USDC
mUSDC.mint(amount); //@audit return value is not checked.
return amount;
}
Assets are first transferred from the Morpho V2 Vault, and then MYTStrategy.sol::deallocate() is invoked. If the mint operation fails silently (i.e., without reverting), the transferred assets can become stuck in the contract.
Impact Details
1.assets become stuck in the contract 2.Those assets are not included in the newTotalAssets calculation within the Morpho V2 Vault
References
Proof of Concept
Proof of Concept
Frist we can find the address of mUSDC on op network via this link https://docs.moonwell.fi/moonwell/protocol-information/contracts#op-mainnet-contract-addresses
The address is : https://optimistic.etherscan.io/address/0x8E08617b0d66359D73Aa11E11017834C29155525
the mint function :
/**
* @notice Sender supplies assets into the market and receives mTokens in exchange
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param mintAmount The amount of the underlying asset to supply
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function mint(uint mintAmount) external override returns (uint) {
(uint err, ) = mintInternal(mintAmount);
return err;
}
function mintInternal(
uint mintAmount
) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return (
fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED),
0
);
}
// mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to
return mintFresh(msg.sender, mintAmount);
}
@return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
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
The strategy ignores the error code returned by the external mint call, which reports failure by return value rather than by reverting.
Impact
Assets could become permanently stuck in the strategy and would not be counted in the vault's newTotalAssets calculation.
What the attacker needed
Mint call returns an error instead of reverting
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.
A smart contract can report a problem in two ways: by stopping everything (reverting) or by returning an error code. Here the lending market returns an error code when a deposit fails, but the strategy never looks at it, so it carries on as if the deposit worked. The money sent in for that deposit then sits in the wrong place and is not counted.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.