Smart Security Practices From The Best
What do Lido, Red Stone, YieldNest, and Braintrust have in common? They’ve developed effective methods for improving security without drastically increasing costs. Top-tier protocol […]
This results in non-compliance with the ERC4626 standard, leading to the potential
for withdrawal attempts based on maxWithdraw results to fail.
Per the ERC4626 standard, the maxWithdraw function is required to return the maximum amount of assets that can be withdrawn without causing a revert, and this amount must not exceed the actual maximum that can be accepted.
In the BaseVault and KernelStrategy contracts, the maxWithdraw function has not been updated to include fees. As a result, it calculates the total assets without factoring in the fees, which may cause the calculated shares to exceed the user’s available shares when they attempt to withdraw the maximum amount suggested by maxWithdraw .
The following actions illustrate this issue:
MaxVault, adding a feature for users to withdraw their total assets.maxWithdraw to determine the total withdrawable assets for that user, then invokes the withdraw function.MaxVault computes the shares to be burnt using the previewWithdraw function, which results in a calculation that suggests burning more shares than the user possesses._burn function call.MEDIUM – This results in non-compliance with the ERC4626 standard, leading to the potential for withdrawal attempts based on maxWithdraw results to fail.
The maxWithdraw function should be updated to account for fees, thus providing a more accurate amount of assets that a user may withdraw.
Meet Composable Security
Get throughly tested by the creators of Smart Contract Security Verification Standard
Let us help
Get throughly tested by the creators of Smart Contract Security Verification Standard