Open code423n4 opened 1 year ago
trust1995 changed the severity to 2 (Med Risk)
trust1995 marked the issue as primary issue
trust1995 marked the issue as satisfactory
tess3rac7 marked the issue as sponsor confirmed
trust1995 marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-02-ethos/blob/main/Ethos-Vault/contracts/ReaperVaultV2.sol#L368-L408
Vulnerability details
Impact
Contracts that integrate with the
ReaperVaultERC4626
vault (including Ethos contracts) may wrongly assume that the functions are EIP-4626 compliant, which it might cause integration problems in the future, that can lead to a wide range of issues for both parties, including loss of funds.Proof of Concept
This PoC describes this issue for the
withdraw
function, but there is the same problem with theredeem
function.EIP-4626 specification says that the
withdraw
function:This is the
withdraw
function:When the internal
_withdraw
is called, thevalue
represents the total amount of assets that will be transferred to the receiver. There is a special case where there could be a withdrawal that exceeds the total balance of the vault:In this case, if a strategy incurs any losses, the actual withdrawal amount will NOT be the exact same specified when calling the
withdraw
function, as it will be less than that, as the loss is detracted from the withdrawn value:If that happens, then
assets requested > assets received
.As the specification says that the withdrawal process
MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc)
, this makes theReaperVaultERC4626
non EIP-4626 compliant.This might cause integration problems in the future, which can lead to a wide range of issues, including loss of funds.
Because EIP-4626 is aimed to create a consistent and robust implementation pattern for Tokenized Vaults, and even a slight deviation from the standard would break composability (and potentially lead to a loss of funds), this is categorized as a high risk.
Tools Used
Manual review
Recommended Mitigation Steps
The
withdraw
andredeem
functions should be modified to meet the specifications of EIP-4626: thevalue
transferred must always be equal to theassets
withdrawn. In case this is not true, the transaction must be reverted.