createLeveragedPosition applies no check that _borrowToken differs from _flashLoanToken (the collateral token).
If both are the same asset, the protocol flash-loans token A, supplies it as collateral, borrows token A again (from the same Aave supply), then swaps token A → token A via 1inch (a no-op swap at best, a slippage-generating swap at worst), and repays the flash loan with the borrowed amount.
The net result is an identical collateral and debt position denominated in the same asset — Aave's effective leverage in this case is zero, since any price move affects both collateral value and debt value equally.
When _borrowToken == _flashLoanToken:
Flash loan borrows N WETH
aavePool.supply(WETH, N + userCollateral) — supplies WETH collateral
aavePool.borrow(WETH, borrowAmount) — borrows WETH against WETH collateral
1inch swap of WETH → WETH: at best a zero-fee identity swap returning exactly the input; at worst a slippage-consuming swap
Flash loan repaid with borrowed WETH — net state: same WETH collateral, WETH debt, no actual leverage
Likelihood:
Off-chain tooling that allows any ERC-20 for both collateral and borrow token can produce this misconfiguration by user error
Automated position managers that do not validate token pair distinctness before calling can trigger this path
The missing guard is a single-line oversight
Impact:
The position costs the user the flash loan fee, gas, and potential 1inch slippage with no economic benefit — all capital is locked in Aave in a hedged position where leverage = 1x (no leverage)
The event LeveragePositionCreated is emitted with what appears to be a valid position, misleading off-chain accounting
If the 1inch swap for an identical pair incurs significant slippage (e.g., WETH → WETH routed through a pool at non-1:1 rate), the returnAmount >= totalDebt check may fail, wasting all the gas of the flash loan callback
Add an explicit distinctness check at the entry point:
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.