createLeveragedPosition pulls user collateral via transferFrom before initiating the flash loan. The return value is not checked.
If the token returns false instead of reverting, the contract records _collateralAmount in the flash loan params, but never received the tokens. The flash loan callback then attempts to supply _amount + flashParams.collateralAmount to Aave with only the flash-loaned funds present.
Likelihood:
Non-reverting ERC20 tokens return false on failed transfers — USDT, BNB among others exhibit this behaviour
The collateral transfer is the first action in the function, before any further validation
Impact:
Flash loan is initiated with inflated collateral params; Aave supply() call reverts mid-callback with the flash loan unrepaid
Depending on prior contract token balances, the callback could partially succeed with incorrect position accounting
Replace the bare transferFrom with SafeERC20.safeTransferFrom() which reverts immediately if the transfer fails, preventing the flash loan from being initiated with unverified collateral amounts.
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.
The contest is complete and the rewards are being distributed.