maxDeposit() uses yieldVault.maxDeposit() but _depositAndMint() uses yieldVault.mint()
The vault's maxDeposit() returns a limit based on the yield vault's maxDeposit(), but deposits actually use the yield vault's mint() function, which may have a stricter limit. An attacker could attempt to deposit the reported maximum and cause a revert, violating EIP-4626 compliance.
Submitted by d3e4
maxDeposit() might return a value greater than can be deposited, violating EIP-4626.
Proof of Concept
maxDeposit() returns up to yieldVault.maxDeposit(address(this)). However, _depositAndMint() deposits using yieldVault.mint() which may have a stricter limit than yieldVault.deposit(). In that case depositing maxDeposit() would revert, which violates EIP-4626.
Recommended Mitigation Steps
Use yieldVault.previewRedeem(yieldVault.maxMint()).
Assessed type
ERC4626
hansfriese (judge) decreased severity to Low and commented:
It’s a valid concern and QA is more appropriate due to the low impact. I will mark as grade-a with some unique issues.
Isn’t a violation of EIP-4626, for a vault that claims to be compliant, at least a Medium severity because of the integration issues it implies?
Note that being EIP-4626 compliant is explicitly stated in the README and that adherence to this was listed as one of the Attack ideas.
hansfriese (judge) increased severity to Medium and commented:
After checking again, I agree Medium is more appropriate as it may violate ERC4626 compliance.
trmid (PoolTogether) acknowledged and commented:
After further evaluation, the suggested mitigation seems to cause issues in common ERC4626 yield vaults since
maxMintcommonly returnstype(uint256).maxand callingpreviewRedeemorpreviewMintwith such a high value also commonly causes an overflow error on conversion.As long as the yield vault
maxDepositfunction takes into account any internal supply limits, the current implementation is unlikely to have any compatibility issues and will be left as-is.
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
Impact
Depositing the maximum amount reported by maxDeposit() could revert, violating EIP-4626 compliance and potentially causing integration issues.
What the attacker needed
Yield vault's mint limit stricter than deposit limit
The fix
The suggested mitigation (using previewRedeem(maxMint())) was found to cause overflow issues, and the team decided to leave the code as-is, noting that if the yield vault's maxDeposit accounts for internal supply limits, compatibility issues are unlikely.
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.
A vault contract tells users the maximum amount they can deposit by asking its underlying yield vault for its deposit limit. However, when a user actually deposits, the vault uses a different function (mint) that might have a lower limit. So a user following the advertised maximum could see their transaction fail, which breaks a standard rule for such vaults.
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.