_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.
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:
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.