The current implementation of swap operations in the LeverageZapRouterBase contract lacks proper slippage protection, potentially exposing users to significant financial losses due to unfavorable trade execution.
Look at the _getSwapOperations function:
https://github.com/code-423n4/2024-06-badger/blob/9173558ee1ac8a78a7ae0a39b97b50ff0dd9e0f8/ebtc-zap-router/src/LeverageZapRouterBase.sol#L232-L247
The function creates a SwapOperation, but the slippage protection (via swapChecks) is only applied if _tradeData.performSwapChecks is true. This boolean flag allows the possibility of swaps to be executed without any slippage protection.
Even when slippage checks are performed, they rely entirely on the _tradeData.expectedMinOut value provided by the caller, without any on-chain validation of this values reasonableness.
Always enforce slippage protection for swap operations by removing the performSwapChecks condition. Implement on-chain logic to calculate a reasonable minOut value based on current market conditions and a configurable maximum allowed slippage percentage. Consider using a price oracle to validate that the executed swap price is within acceptable bounds.
