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

Potential DoS in require(minOut > _amount, "minOut too low"); condition in StrategyOp:: _swapUnderlyingToAsset

Summary

The condition minOut > _amount may lead to a Denial-of-Service (DoS) scenario due to external price manipulation, such as a sandwich attack or price imbalance caused by liquidity fluctuations or an asset depegging.

function _swapUnderlyingToAsset(uint256 _amount, uint256 minOut, IVeloRouter.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)); // checkes for balance of current contract
require(underlyingBalance >= _amount, "not enough underlying balance");
IVeloRouter(router).swapExactTokensForTokens(_amount, minOut, _path, address(this), block.timestamp);
// What are the various means of add to the pool?
}

Vulnerability Details

At Genesis, If the swap involves assets with low liquidity, it is vulnerable to price manipulation. An attacker could front-run this transaction to profit from price movement, especially if the minOut the parameter is too lenient.

Impact

Denial of Service of the _swapUnderlyingToAsset function, which other contract functions rely on.

Tools Used

Manual review.

Recommendations

Recommendation: Use a price oracle to validate minOut against a realistic minimum value based on the actual market rate with some slippage tolerance. Example:

uint256 oraclePrice = getOraclePrice(); // Fetch from a trusted price oracle
uint256 acceptableMinOut = (_amount * oraclePrice) / 1e18;
require(minOut >= acceptableMinOut, "minOut below oracle price");
Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago

Appeal created

inallhonesty Lead Judge 7 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.