Vault.sol is not EIP-4626 compliant
The Vault contract does not fully implement the EIP-4626 tokenised vault standard: it lacks the mint and redeem functions, its max* functions do not return zero when deposits or withdrawals are disabled, previewDeposit ignores fees, and totalAssets omits assets paid out during a depeg or at epoch end. Other protocols integrating with Y2K may wrongly assume compliance, which could cause integration problems and potentially loss of funds.
Submitted by 0x52, also found by Bahurum, Jeiwan, Lambda, PwnPatrol, and thebensams
Impact
Other protocols that integrate with Y2K may wrongly assume that the functions are EIP-4626 compliant. Thus, it might cause integration problems in the future that can lead to wide range of issues for both parties.
Proof of Concept
All official EIP-4626 requirements can be found on it’s official page. Non-compliant functions are listed below along with the reason they are not compliant:
The following functions are missing but should be present:
- mint(uint256, address) returns (uint256)
- redeem(uint256, address, address) returns (uint256)
The following functions are non-compliant because they don’t account for withdraw and deposit locking:
- maxDeposit
- maxMint
- maxWithdraw
- maxRedeem
All of the above functions should return 0 when their respective functions are disabled (i.e. maxDeposit should return 0 when deposits are disabled)
previewDeposit is not compliant because it must account for fees which it does not
totalAssets is not compliant because it does not always return the underlying managed by the vault because it fails to include the assets paid out during a depeg or the end of the epoch.
Recommended Mitigation Steps
All functions listed above should be modified to meet the specifications of EIP-4626.
MiguelBits (Y2K Finance) confirmed
The premise is valid because it’s stated in the README:
Y2K leverages ERC4626 Vault standard for this protocol, this contract is a fork of that standard, although we replaced all uses of ERC20 to ERC1155.
As per the ruling in a previous contest regarding EIP4626.
Judging this and all duplicate regarding EIP4626 implementation as High Risk. EIP4626 is aimed to create a consistent and robust implementation patterns for Tokenized Vaults. A slight deviation from 4626 would broke composability and potentially lead to loss of funds. It is counterproductive to implement EIP4626 but does not conform to it fully.
The missing functions are the most problematic; one expects the
mint()andredeem()to be present, but they’re absent instead.Disagree on the
max*()functions issues;SemiFungibleVaultis not pausable, functions can’t be disabled / paused. Perhaps the inheriting contracts should override these functions, but the way I see it, they can be arbitrarily set in the template.Agree on subsequent points mentioned.
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 vault was forked from an EIP-4626 implementation but modified (for example replacing ERC20 with ERC1155) without updating all required functions to match the standard.
Impact
Protocols integrating with Y2K may wrongly assume EIP-4626 compliance, which could cause integration problems and potentially loss of funds.
What the attacker needed
Another protocol integrates with the vault
The fix
The listed functions should be modified to meet the EIP-4626 specification.
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.
EIP-4626 is a standard that defines how a 'vault' contract should behave so other programs can safely interact with it. This vault claims to follow that standard but is missing required functions and gives wrong answers in others, so other programs that trust it could misbehave. The report lists each deviation from the standard.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.