ThunderLoan increases the AssetToken exchange rate when a flash loan fee is collected, distributing the fee yield to LPs. This rate update should happen only after confirming repayment.
flashloan calls assetToken.updateExchangeRate(fee) before the token transfer and before the callback fires. An attacker who is both an LP and a flash loan borrower can call redeem() during the callback at the fee-inflated rate — extracting yield that has not yet been earned — then repay the flash loan at face value.
Likelihood:
Any LP who also calls flashloan — a natural combination in a flash loan protocol — can exploit this during their callback.
Read-only reentrancy via the inflated exchange rate affects any external protocol that reads the AssetToken rate during the callback window.
Impact:
LPs who are also flash loan borrowers extract fee yield before it is earned, stealing from other LPs who have not yet accumulated their share.
External protocols reading the AssetToken exchange rate during a flash loan callback receive an incorrect inflated value, enabling a class of read-only reentrancy attacks.
Place this test in test/ and run forge test --match-test testLpBorrowerAttack. The test demonstrates that an LP holder can call redeem() inside a flash loan callback after the exchange rate is inflated by the fee, withdrawing more underlying tokens than they originally deposited.
Move updateExchangeRate(fee) to after the repayment balance check so the rate is only bumped once repayment is confirmed.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.