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

Swap yield can be extracted

Summary

The claimAndSwap function in the StrategyMainnet contract is vulnerable to MEV attacks due to predictable value changes, allowing users to extract profits by timing deposits and withdrawals around the swap execution.

Vulnerability Details

The vulnerability exists in the claimAndSwap function in StrategyMainnet.sol:

function claimAndSwap(
uint256 _amountClaim,
uint256 _minOut,
uint256 _routeNumber
) external onlyKeepers {
transmuter.claim(_amountClaim, address(this));
uint256 balBefore = asset.balanceOf(address(this));
require(_minOut > _amountClaim, "minOut too low");
router.exchange(
routes[_routeNumber],
swapParams[_routeNumber],
_amountClaim,
_minOut,
pools[_routeNumber],
address(this)
);
// ... rest of function
}

The issue occurs because:

  1. The swap execution creates a predictable increase in strategy value due to the premium received when swapping WETH to alETH

  2. Users can observe pending claimAndSwap transactions in the mempool

  3. Users can:

    • Front-run by depositing before the swap

    • Back-run by withdrawing after the swap and report

    • Extract the majority of the swap yield as profit

Impact

Users can extract value from the strategy at the expense of other depositors by:

  • Capturing the majority of swap premiums through well-timed deposits/withdrawals

  • Reducing returns for long-term strategy holders

  • Making the strategy unprofitable for its intended purpose

Tools Used

Manual Review

Recommendations

Use a private mempool for swap execution or consider adding withdrawal fee or timelock to at least make the attack unprofitable or too risky.

Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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