LiquidityGauge is not compliant with EIP-4626 due to MIN_SHARES constraint
The LiquidityGauge contract's maxWithdraw and maxRedeem functions do not account for the MIN_SHARES constraint, so they can return amounts that cause a revert when used. This violates the EIP-4626 standard, which requires these functions to return the maximum amount that would not revert.
Source: https://github.com/sherlock-audit/2025-08-yield-basis-judging/issues/403
Found by
AnomX, ge6a
Summary
According to the README, LiquidityGauge is supposed to comply with EIP-4626. However, it does not, because the maxWithdraw and maxRedeem functions violate the standard by not accounting for MIN_SHARES.
Root Cause
Per EIP-4626:
MUST return the maximum amount of shares that could be transferred from owner through redeem and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).
MUST factor in both global and user-specific limits; for example, if redemption is entirely disabled (even temporarily) it MUST return 0.
However, if after a withdraw / redeem the remaining shares would fall below MIN_SHARES, each of these functions will revert due to the _check_min_shares guard.
Therefore, the requirement that maxWithdraw / maxRedeem return the maximum amount that would not revert is violated, and the Gauge is not compliant with EIP-4626.
Internal Pre-conditions
None
External Pre-conditions
None
Attack Path
- User call
maxWithdraw/maxRedeemand receive specific amount - User call
withdraw/redeemwith the amount from point 1) but it reverts because of the MIN_SHARES check (supply > 0 but < MIN_SHARES)
Impact
The gauge is not compliant with EIP-4626
PoC
No response
Mitigation
Adjust maxWithdraw / maxRedeem to take into consideration the MIN_SHARES limit as expected from the EIP-4626 standard
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 maxWithdraw and maxRedeem functions do not factor in the MIN_SHARES guard that causes withdraw and redeem to revert when remaining shares would fall below the minimum.
Impact
The gauge is not compliant with EIP-4626, which could lead to failed transactions when users rely on the max functions.
What the attacker needed
None
The fix
Adjust maxWithdraw and maxRedeem to take the MIN_SHARES limit into account as required by EIP-4626.
How it was found
- User calls maxWithdraw or maxRedeem and receives a specific amount.
- User calls withdraw or redeem with that amount, but it reverts because of the MIN_SHARES check.
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.
EIP-4626 is a standard for tokenised vaults that defines functions like maxWithdraw and maxRedeem, which should tell you the largest amount you can withdraw or redeem without the transaction failing. Here, the contract has a rule that your remaining shares cannot be too small, but the max functions ignore that rule, so they can give you a number that will actually cause an error if you try to use it.
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.