F-2025-0005·missing-slippage-protection

Lack of slippage protection allows exploitation of Pendle trades

Fixedvaultetfstrategyd2-contracts
TL;DR

Six entry points in Pendle_Module pass minAmountOut = 0 to the Pendle router, removing all slippage protection. MEV bots can sandwich every Pendle trade the strategy makes, extracting value at the expense of D2 stakers.

Severity
MEDIUM
Impact
MEDIUM
Likelihood
HIGH
Method
MManual review
CAT.
Complexity
LOW
Exploitability
HIGH
02Section · Description

Description

Pendle_Module is the strategy facet that drives D2's exposure to Pendle (a permissionless yield-trading protocol with PT, YT and SY token types). The module exposes deposit, withdraw, swap, claim, and exit functions, all of which forward to Pendle's IPRouter or related contracts.

Every one of these forwarding calls hardcodes the slippage parameter (minLpOut, minTokenOut, minPtOut, minYtOut, etc.) to 0:

solidity
// pendle_deposit, L69
router.addLiquiditySingleToken(
address(this),
address(market),
0, // minLpOut hardcoded to 0
approxParams,
input,
limitOrderData
);
// pendle_withdraw, L86
IPRouter.TokenOutput memory output = IPRouter.TokenOutput({
tokenOut: ast,
minTokenOut: 0, // hardcoded to 0
tokenRedeemSy: ast,
pendleSwap: address(0),
swapData: swapData
});

The same pattern appears in pendle_swap (L140, L150, L170), pendle_claim (L197), and pendle_exit (L216). Because the strategy operates on-chain and the executor's transactions are public mempool transactions, MEV searchers can detect any of these calls and sandwich them by moving the Pendle market price before and after the strategy trade. Without minAmountOut, there is no mechanism to revert the trade when execution price drifts beyond an acceptable bound.

03Section · Impact

Impact

  • Every Pendle interaction is fully exposed to MEV front-running and price manipulation.
  • Sandwich attacks can extract value from each trade with no cap on losses.
  • Over time, D2 stakers lose yield equal to the cumulative slippage taken by MEV searchers.
04Section · Recommendation

Recommendation

Allow the trader to pass minAmountOut (and equivalents like minLpOut, minPtOut, minYtOut) as parameters on every Pendle entry point. The trader can compute these off-chain based on the quoted price and an acceptable slippage tolerance, then pass them through to the router call.

05Section · Resolution

Resolution

D2: Fixed in cd7058d.

Cyfrin: Verified.

Status
Fixed
Fix commit
cd7058d
F-2025-0005