Skip to content
Business logic Audit finding Intermediate

_maxYieldVaultWithdraw() uses yieldVault.convertToAssets()

The function _maxYieldVaultWithdraw() used yieldVault.convertToAssets(), which per EIP-4626 is only approximate and may return too much. This could cause maxWithdraw(), maxRedeem(), and liquidatableBalanceOf() to return inflated values, violating EIP-4626 for the first two.

d3e4 Follow with d3e4

Originally disclosed on Code4rena

Submitted by d3e4, also found by d3e4

Proof of Concept

function _maxYieldVaultWithdraw() internal view returns (uint256) {
    return yieldVault.convertToAssets(yieldVault.maxRedeem(address(this)));
}

The above code uses yieldVault.convertToAssets() which, per EIP-4626, is only approximate. Especially, it might return too much, and thus _maxYieldVaultWithdraw() might return too much. _maxYieldVaultWithdraw() is used in maxWithdraw(), in maxRedeem(), and in liquidatableBalanceOf() which functions may thus return too much. In the case of maxWithdraw() and maxRedeem() this violates EIP-4626.

Recommended Mitigation Steps

Use yieldVault.previewRedeem(yieldVault.maxRedeem(address(this))).

Assessed type

ERC4626

trmid (PoolTogether) confirmed and commented:

Mitigation here. Also see here for more details.


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

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 use of an approximate conversion function (convertToAssets) instead of a precise preview function (previewRedeem) when computing the maximum withdrawable amount.

Impact

The functions maxWithdraw() and maxRedeem() may return too much, violating EIP-4626, and liquidatableBalanceOf() may also return too much.

What the attacker needed

None

The fix

The code should be fixed by using yieldVault.previewRedeem(yieldVault.maxRedeem(address(this))) instead of convertToAssets.

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.

This report is about a smart contract that follows a standard called EIP-4626 for tokenised vaults. The code used a conversion function that is allowed to be approximate, so the maximum amounts it reported could be higher than what is actually available. That breaks the standard's requirement that these maximums be accurate.

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 d3e4

View all

19 more disclosed reports, best first.

More from PoolTogether

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.