You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
github-actionsbot opened this issue
Mar 10, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Most of the share based vault type implementation faces this issue.
The Pool is inspired from ERC4626 where the shares (Pool Tokens) are calculated based on the deposit value.
By depositing large amount as initial deposit, initial depositor can influence the future depositors value and can steal the funds too.
Vulnerability Detail
Problems with the code:
Integer division negatively affect the user.
Can be manipulated to cause a large loss, specifically for first victim.
Consider the following situation:
Attacker deposits 1 wei of LT (Loan Token).
Next, Attacker transfers 100 LT to the contract.
Victim deposits 200 LT.
Attacker withdraws 1 share.
Have a look at this table to understand the complete PoC:
Before
Before
After
After
Tx
totalSupply
balanceOf
sharesGiven
totalSupply
balanceOf
BeforeAttacker deposits 1 wei of LT.
0
0
1
1
1
Attacker transfers 100 WETH to the contract.
1
1
N/A
1
1 + 100 x 10^18
Victim deposits 200 WETH.
1
1 + 100 x 10^18
=1.99 = 1
2
1 + 300 x 10^18
Attacker withdraws 1 share.
2
1 + 300 x 10^18
N/A
1
1 + 150 x 10^18
Impact
It can lead to some part of Fund getting stolen from First Depositor.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Breeje
high
First Depositor Attack Vulnerability
Summary
Most of the share based vault type implementation faces this issue.
The
Pool
is inspired from ERC4626 where the shares (Pool Tokens) are calculated based on the deposit value.By depositing large amount as initial deposit, initial depositor can influence the future depositors value and can steal the funds too.
Vulnerability Detail
Problems with the code:
Consider the following situation:
Have a look at this table to understand the complete PoC:
Impact
It can lead to some part of Fund getting stolen from First Depositor.
Code Snippet
Link to Code
Tool used
VS Code
Recommendation
Duplicate of #125
The text was updated successfully, but these errors were encountered: