A malicious LP can deposit
some funds and redeem
immediately after deposit
, and he can repeat this process multiple times because there is no depositFee in ThunderLoan::deposit
function and this could lead to drain all the funds of the pool.
Protocol is taking deposit
and increasing the exchangeRate
of that token. Now all an attacker need is some funds there are 2 ways to get funds:
He has his own funds
Can take flash loan
Here is how it will work
Attacker deposit
1 tokenA (ie 1e18) and got 1 lpTokenA at an exchangeRate of 1:1
exchangeRate
will now increase to 1.3(just for example)
Attacker will redeem
1 lpTokenA and will get 1.3 tokenA(1 * 1.3) ie 0.3 tokenA more
Will repeat this until pool drains
Note: This will be more easy if attacker has more funds. Marking as high because taking flashloan
is not that hard and also flashloan
fee also negligible as compare to what attacker will make from here.
Here is the PoC
To run test
Result
LP will lose all of their funds and intersts
Manual review, Foundry
Charge some amount of fee on deposit
that will make costly for an attacker to perform this task.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.