Summary
The _swapUnderlyingToAsset function in the StrategyOp contract lacks robust slippage control mechanisms. While the function enforces that minOut > _amount, this simplistic check places full reliance on the caller to provide appropriate minOut values. This creates a vulnerability where suboptimal swaps can occur, resulting in reduced yields or losses for depositors under manipulated or volatile market conditions.
Technical Details
The _swapUnderlyingToAsset function currently implements a minimal slippage control check:
Input: The function receives _amount (WETH), minOut (alETH), and a swap path.
Process:
Checks that minOut > _amount.
Ensures sufficient underlying balance.
Executes a token swap using the Velo Router.
Output: The function transfers the resulting tokens (alETH) to the strategy.
The function's reliance on the caller to set an appropriate minOut introduces risks:
Simplistic Control: The minOut > _amount check does not validate the actual market conditions or path efficiency.
Caller-Dependent Safeguard: Malicious or careless input values for minOut can result in suboptimal swaps.
Setup:
An attacker manipulates the swap path or creates market volatility, impacting the token exchange rate.
The attacker sets minOut to a value slightly above _amount, ensuring the check passes.
Execution:
The function executes the swap, accepting a reduced output that is just above _amount.
Impact:
The strategy receives significantly less alETH than it should under fair market conditions.
Setup:
In volatile market conditions, the actual swap rate drops significantly.
The function still executes the swap due to a loose minOut value.
Impact:
The strategy experiences a reduced yield, negatively affecting depositors.
Financial Impact:
Suboptimal swaps lead to reduced yields, directly affecting user returns.
Quantifiable example: A swap intended to yield 100 alETH results in only 90 alETH, causing a 10% loss.
Operational Impact:
Repeated suboptimal swaps degrade the strategy’s performance and user trust.
Simplistic Slippage Control:
The check minOut > _amount does not account for actual market conditions or potential manipulation.
Caller Dependency:
Relies entirely on the caller to set an appropriate minOut.
Validate minOut against market conditions using price oracles:
Allow the caller to specify a slippage percentage, e.g., 1%, and calculate minOut dynamically:
Step-by-Step Reproduction:
Deploy the contract and initialize the router.
Execute _swapUnderlyingToAsset with the following parameters:
_amount: 1,000 WETH.
minOut: 1,100 alETH.
_path: Manipulated swap path.
Manipulate the market or path to yield only 1,050 alETH during the swap.
Observe the reduced yield despite the swap executing successfully.
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.