Lack of slippage protection allows exploitation of Pendle trades
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.
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:
// pendle_deposit, L69router.addLiquiditySingleToken(address(this),address(market),0, // minLpOut hardcoded to 0approxParams,input,limitOrderData);// pendle_withdraw, L86IPRouter.TokenOutput memory output = IPRouter.TokenOutput({tokenOut: ast,minTokenOut: 0, // hardcoded to 0tokenRedeemSy: 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.
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.
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.
Resolution
D2: Fixed in cd7058d.
Cyfrin: Verified.