ReaperVaultV2: FIRST DEPOSITOR CAN BREAK MINTING OF SHARES #349
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-848
grade-b
Q-81
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
satisfactory
satisfies C4 submission criteria; eligible for awards
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Vault/contracts/ReaperVaultV2.sol#L331-L336
Vulnerability details
Impact
Users may can not receive shares in exchange for their deposits if the total asset amount has been manipulated through a large "donation".
Proof of Concept
Considering two users: User1 and User2
User1 deposits 1 wei to mint 1 share
User1 transfers exorbitant amount to the vault contract to greatly inflate the share’s price. Here we trnasfer 10 Unit and the share become (10 Unit + 1 wei)
User2 has to deposit an equivalent sum to avoid minting 0 shares. Otherwise, if User2 only deposit 10 Unit, he will get ZERO share and his deposits accrue to the User1 who holds the only share.
User1 withdrawAll to get User2's deposit.
Insert this test into
starter-test.js
.Tools Used
Hardhat
Recommended Mitigation Steps
Ensure the number of shares to be minted is non-zero:
The text was updated successfully, but these errors were encountered: