-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReaperVaultV2 inflation attack #848
Comments
trust1995 marked the issue as primary issue |
trust1995 marked the issue as satisfactory |
We have received this report over and over through the last year or so across different platforms. DEPOSITOR role is trusted and will only be granted to ActivePool. In the more general case (outside of Ethos), Reaper's vaults always undergo manual testing whereby funds are deposited before we invite the public to utilize the vault. I will not dispute the validity since this is a valid scenario, but it will never occur in the case of Ethos (since only one DEPOSITOR being ActivePool), and never really occur otherwise outside of ethos. Recommend low severity. |
tess3rac7 marked the issue as disagree with severity |
I agree with sponsor that the finding severity is low, given the centralized nature of the DEPOSITOR role. |
trust1995 changed the severity to QA (Quality Assurance) |
trust1995 marked the issue as grade-b |
Lines of code
https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Vault/contracts/ReaperVaultV2.sol#L334
Vulnerability details
Impact
A hacker can drain new deposits into the pool by causing a rounding error in a share-issuing function:
The
ReaperVaultV2._deposit()
method issues zero shares for the victim if thefreeFunds
(which is proportional totoken.balanceOf(address(vault))
) is greater than_amount * totalSupply()
(which may be the case if thetotalSupply()
is low).The impact is not high because a hacker can only deposit into the pool via contracts that have the DEPOSITOR role (e.g. ActivePool).
Proof of Concept
Let's consider a scenario where there are two contracts that have the DEPOSITOR role. We will refer to the first contract as the HACKER and the second as the VICTIM.
vault.deposit(1 wei)
.20_000e18 wei
.token.transfer(vault, 20_000e18)
.This happens because the
freeFunds
are proportional to the vault's balance and hacker can manipulate it by direct donations:https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Vault/contracts/ReaperVaultV2.sol#L288
https://github.com/code-423n4/2023-02-ethos/blob/73687f32b934c9d697b97745356cdf8a1f264955/Ethos-Vault/contracts/ReaperVaultV2.sol#L279
Tools Used
Manual
Recommended Mitigation Steps
To prevent errors, it is recommended to add a requirement that
shares
cannot be equal to zero.The text was updated successfully, but these errors were encountered: