Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: high
Invalid

re-entrancy in flashloan() with deposit()

Summary

flashloan() can is vulnerable to re-entrancy that could drain all funds.

Vulnerability Details

flashloan() is making a callback to receiverAddress, by calling executeOperation(). It does check that the amount of tokens have been repaid (fees included). However, it fails to account for the attacker re-entering the contract with deposit(). This will mint him assetTokens that can be redeemed for his shares (profits included) as a creditor. This will trick flashloan() into thinking the attacker repaid the loan with the fees since he changed the balance of tokens, when in fact he has also minted assetTokens that can be redeemed.

Impact

All funds in the smart contract could be drained. This also affects the newer ThunderLoanUpgraded.sol.

Tools Used

Manual Review.

Recommendations

Use a nonReentrant modifier lock to prevent re-entrancy.

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Vague generalities

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.