flashloan() can is vulnerable to re-entrancy that could drain all funds.
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.
All funds in the smart contract could be drained. This also affects the newer ThunderLoanUpgraded.sol.
Manual Review.
Use a nonReentrant modifier lock to prevent re-entrancy.
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.