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

Ineffective Deadline Protection Enables Exploitation by Malicious Attackers

Code Snippets

https://github.com/Cyfrin/2024-12-alchemix/blob/82798f4891e41959eef866bd1d4cb44fc1e26439/src/StrategyOp.sol#L79-L89

Summary

The claimAndSwap function's deadline protection is inadequate, making it susceptible to exploitation by front-runners or any parties capable of manipulating transaction sequencing to gain an unfair advantage over legitimate keepers.

Vulnerability Details

claimAndSwap function uses _swapUnderlyingToAsset function to swap underlying asset. Accordingly, _swapUnderlyingToAsset function interacts with router using swapExactTokensForTokens function:

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));
require(underlyingBalance >= _amount, "not enough underlying balance");
IVeloRouter(router).swapExactTokensForTokens(_amount, minOut, _path, address(this), block.timestamp);
}

block.timestamp is utilized in purpose of slippage control.

By depending on the current timestamp to enforce deadlines, the system inadvertently weakens the intended purpose of establishing a strict time limit, as this timestamp can be delayed or manipulated at will.

In the absence of a clearly defined and immutable deadline determined by the keeper, this mechanism unintentionally creates opportunities for malicious actors, such as front-runners and MEV bots, to exploit the system. These entities can manipulate transaction timing and sequence to act in their own interest, thereby compromising the fairness and efficiency intended for honest participants.

Impact

The reliance on block.timestamp for slippage control undermines the integrity of the system, enabling malicious actors like front-runners to manipulate transaction timing and sequencing, leading to unfair advantages, compromised security, and potential financial losses for honest participants.

Tools Used

Manual Review

Recommendations

Add a strict and user-chosen deadline parameter to the claimAndSwap() to ensure proper slippage control.

Updates

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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