-
Notifications
You must be signed in to change notification settings - Fork 0
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
Vault is vulnerable to Inflation Attack #10
Comments
MiloTruck marked the issue as duplicate of #3 |
MiloTruck marked the issue as satisfactory |
MiloTruck marked the issue as selected for report |
MiloTruck changed the severity to 2 (Med Risk) |
Due to the existence of 1 virtual share in Solady's Since attackers have a significant chance of losing funds when performing such an attack, I don't believe they have sufficient incentive to pull this off. Additionally, users can call As such, I believe QA is appropriate. |
MiloTruck changed the severity to QA (Quality Assurance) |
MiloTruck marked the issue as not selected for report |
MiloTruck marked the issue as grade-b |
Lines of code
https://github.com/code-423n4/2024-07-karak/blob/f5e52fdcb4c20c4318d532a9f08f7876e9afb321/src/Vault.sol#L78-L119
Vulnerability details
Impact
Malicous first depositor can steal assets off subsequent users.
Vulnerability Details
The vulnerability follows the path of the classic Inflation Attack whereby the First Depositor whos is the attacker mints 1 share for 1 wei and then donates a large amount directly to the vault.
It exploits "Rounding to Zero" to ensure that subsequent users receive zero shares for their deposits meaning the attacker's single share has the only claim over the funds in the vault.
The particular version of the erc4626 vault being used does make the attack more expensive though it is still possible to exploit.
The attacker needs to directly deposit into
vault.sol
double the largest amount being deposited by his victims.For example to break even if bob (the attacker) sees alice & mike's pending deposits which are both for an amount of
1e18
he needs to deposit 2e18 to make his money back and ensure they receive zero sharesPOC
Add the following test function below to
vault.t.sol
and run:Donation Attack
Tools Used
Manual Review
Foundry Testing
Recommendations
A good approach is to mint a minimum number of shares to the zero address, during contract deployment similar to the approach taken by UniswapV2
Assessed type
ERC4626
The text was updated successfully, but these errors were encountered: