DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: low
Invalid

`StrategyArb::_swapUnderlyingToAsset`, `StrategyOp::_swapUnderlyingToAsset` and `StrategyMainnet::claimAndSwap` lacks oracle price check

Summary

There is no price check implemented using oracle price feeds while swapping WETH for alWETH using the functions StrategyArb::_swapUnderlyingToAsset, StrategyOp::_swapUnderlyingToAsset and StrategyMainnet::claimAndSwap .

Vulnerability Details

Below is the implementation of StrategyArb::_swapUnderlyingToAsset which takes the params _amount as WETH to swap and minOut as the minimum number of alWETH to receive after swap. Here, it just checks if input param minOut is greater than _amount and after other checks, calls the swap transaction on the Router.

function _swapUnderlyingToAsset(uint256 _amount, uint256 minOut, IRamsesRouter.route[] calldata _path) internal {
// TODO : we swap WETH to ALETH -> need to check that price is better than 1:1
// uint256 oraclePrice = 1e18 * 101 / 100;
require(minOut > _amount, "minOut too low");
uint256 underlyingBalance = underlying.balanceOf(address(this));
require(underlyingBalance >= _amount, "not enough underlying balance");
IRamsesRouter(router).swapExactTokensForTokens(_amount, minOut, _path, address(this), block.timestamp);
}

The transaction would fail if the price of alWETH comparative to WETH does not facilitate getting more alWETH in return for less WETH. However, by using an oracle to check the price of the alWETH, the transaction if has to be reverted, will be reverted way before calling the swap function on the Router.

An oracle price check before the swap would ensure that the transaction only proceeds when the price is within an acceptable range.

Impact

This would led to transaction failures if price of tokens doesn't fall in the acceptable range.

Tools Used

Manual, VSCode

Recommendations

Should add an oracle price check before calling `swapExactTokensForTokens` on the router.

Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[INVALID]Lack of mechanism to ensure premium swaps

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.