Skip to content
Business logic Audit finding Intermediate

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.

AnomX Follow with ge6a

Originally disclosed on Sherlock

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.

https://github.com/sherlock-audit/2025-08-yield-basis/blob/main/yb-core/contracts/dao/LiquidityGauge.vy#L334-L343

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

  1. User call maxWithdraw / maxRedeem and receive specific amount
  2. User call withdraw / redeem with 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

The original report as published on Sherlock, by AnomX. 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 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

  1. User calls maxWithdraw or maxRedeem and receives a specific amount.
  2. 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.

More by AnomX

View all

1 more disclosed report, best first.

More from Yield Basis

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.