The claimAndSwap
function in the smart contract includes a basic check to prevent slippage by ensuring that the swap results in at least a minimum amount of alETH (_minOut
). However, this protection does not account for potential front-running attacks, where an attacker could observe the transaction and manipulate the price before it is executed. This could lead to the keeper receiving less alETH than anticipated, although the function does prevent outright losses.
Suppose the keeper intends to swap 10 WETH for alETH with a minimum output of 90 alETH (_minOut = 90
).
An attacker observes the transaction and places their own swap just before the keeper’s transaction is confirmed, increasing the price of WETH and reducing the amount of alETH the keeper will receive.
The keeper's swap still succeeds, but the slippage protection (require((balAfter - balBefore) >= _minOut)
) ensures that they don’t lose money. However, the final amount of alETH received might be less than originally expected because of the attacker's price manipulation.
The attacker profits from the price change they caused.
Add Time Delay or Timelock: Introduce a short delay before the swap execution to mitigate front-running attacks. This delay could allow the transaction to stabilize and reduce the risk of price manipulation.
Prioritize Gas Fees for Keepers: Implement a mechanism to prioritize gas fees for keepers’ transactions to ensure their swaps execute before any front-running attempts.
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.