The _swapUnderlyingToAsset
function in StrategyArb.sol
only checks that minOut > _amount
before executing swaps. This basic check is insufficient to ensure profitable trades as it only guarantees a 1:1 ratio, which could result in trades being executed at suboptimal rates.
In the _swapUnderlyingToAsset function in StrategyArb.sol
:
The only price check is require(minOut > _amount, "minOut too low")
. This check only ensures that the output amount is greater than the input amount, which is insufficient for two reasons:
It doesn't account for the expected market premium for alETH vs WETH
It doesn't protect against sandwich attacks where an attacker could manipulate the price just enough to pass this check
Example Scenario 1: MEV Sandwich Attack:
// Initial State
Pool: 1000 WETH : 1000 alETH
Market Price: 1 WETH = 1.05 alETH
Strategy wants to swap: 100 WETH
Keeper sets minOut = 101 alETH (passes check as > 100)
1. Attacker front-runs:
Buys large amount of alETH with WETH
Pushes price to 1 WETH = 1.15 alETH
2. Strategy transaction executes:
Swaps 100 WETH
Gets 101 alETH (passes minOut check)
But actual market rate was 1.15 (should get 115 alETH)
Lost 14 alETH in value
3. Attacker back-runs:
Sells alETH back to WETH
Price returns to ~1.05
Profits from the spread
Example Scenario 2: Delayed Execution
Keeper checks price: 1 WETH = 1.03 alETH
Sets minOut = 1.02
Transaction delayed by network
Price moves to 1 WETH = 1.08 alETH
Strategy loses opportunity
The vulnerability leads to:
Direct value loss through sandwich attacks
Opportunity cost from executing at suboptimal rates
MEV extraction that continuously drains value from the protocol
Manual Review
Fetch the expected price from an oracle or external feed and enforce that the swap rate provides a reasonable premium.
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.