_maxYieldVaultWithdraw() uses yieldVault.convertToAssets()
Lines of code
Vulnerability details
Impact
maxWithdraw() and maxRedeem() may return too much, violating EIP-4626. liquidatableBalanceOf() may return too much.
Proof of Concept
solidityfunction _maxYieldVaultWithdraw() internal view returns (uint256) { return yieldVault.convertToAssets(yieldVault.maxRedeem(address(this))); }
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
