ThunderLoan.sol
In flashloan(), updateExchangeRate(fee) is called before tokens are transferred out and before the callback executes. This means the exchange rate reflects a fee that hasn't been collected yet. If a redeem() occurs during the callback, it uses an inflated exchange rate based on uncollected fees.
Likelihood: Medium
Occurs on every flash loan. Exploitable when redeem() is called during the flash loan callback by a third party or by the receiver itself.
Impact: Medium
LPs can redeem at an inflated exchange rate before the fee is actually collected, extracting value that doesn't exist yet.
Severity: Medium
An LP who observes a flash loan in the mempool can sandwich it: call redeem() during the callback (or front-run the flash loan with a redeem() that settles at the pre-fee rate, then back-run with a deposit() at the post-fee rate).
Move the exchange rate update to after the repayment verification:
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.