ThunderLoan::getCalculatedFee divides twice by s_feePrecision (1e18). For small borrow amounts the integer division truncates the fee to zero, so small flash loans are free.
Likelihood: Medium
Any borrow below roughly s_feePrecision / s_flashLoanFee tokens pays no fee; trivially reproducible.
Impact: Low
Fee revenue leaks on small loans; negligible per call, but a free-loan primitive and a precision-correctness defect.
Borrowing 300 wei of an 18-decimal token whose price is 1e18 yields (300 * 1e18 / 1e18) * 3e15 / 1e18 = 0, so the fee truncates to zero and the loan is free:
Restructure the fee math to avoid the double division by s_feePrecision (or enforce a minimum fee) so small borrows cannot round down to a zero fee.
## Description getCalculatedFee can be as low as 0 ## Vulnerability Details Any value up to 333 for "amount" can result in 0 fee based on calculation ``` function testFuzzGetCalculatedFee() public { AssetToken asset = thunderLoan.getAssetFromToken(tokenA); uint256 calculatedFee = thunderLoan.getCalculatedFee( tokenA, 333 ); assertEq(calculatedFee ,0); console.log(calculatedFee); } ``` ## Impact Low as this amount is really small ## Recommendations A minimum fee can be used to offset the calculation, though it is not that important.
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.