The slippage control on the _redeemPT function has been disabled. As a result, it can lead to a loss of assets. Slippage can occur naturally due to on-chain trading activities or the victim being sandwiched by malicious users/MEV.
Vulnerability Detail
In Line 137 of the _redeemPT function, the minTokenOut is set to 0, which disables the slippage control. Note that redeeming one TOKEN_OUT_SY does not always give you one netTokenOut. Not all SY contracts will burn one share and return 1 yield token back. Inspecting the Pendle's source code will reveal that for some SY contracts, some redemption will involve withdrawing/redemption from external staking protocol or performing some swaps, which might suffer from some slippage.
File: PendlePrincipalToken.sol
171: function _initiateWithdrawImpl(
172: address account, uint256 vaultSharesToRedeem, bool isForced
173: ) internal override returns (uint256 requestId) {
174: // When doing a direct withdraw for PTs, we first redeem or trade out of the PT
175: // and then initiate a withdraw on the TOKEN_OUT_SY. Since the vault shares are
176: // stored in PT terms, we pass tokenOutSy terms (i.e. weETH or sUSDe) to the withdraw
177: // implementation.
178: uint256 tokenOutSy = _redeemPT(vaultSharesToRedeem);
179: requestId = _initiateSYWithdraw(account, tokenOutSy, isForced);
180: // Store the tokenOutSy here for later when we do a valuation check against the position
181: VaultStorage.getWithdrawRequestData()[requestId] = abi.encode(tokenOutSy);
182: }
Impact
Loss of assets due to lack of slippage control. Slippage can occur naturally due to on-chain trading activities or the victim being sandwiched by malicious users/MEV.
xiaoming90
High
Lack of slippage control on
_redeemPT
functionSummary
The slippage control on the
_redeemPT
function has been disabled. As a result, it can lead to a loss of assets. Slippage can occur naturally due to on-chain trading activities or the victim being sandwiched by malicious users/MEV.Vulnerability Detail
In Line 137 of the
_redeemPT
function, theminTokenOut
is set to0
, which disables the slippage control. Note that redeeming oneTOKEN_OUT_SY
does not always give you onenetTokenOut
. Not all SY contracts will burn one share and return 1 yield token back. Inspecting the Pendle's source code will reveal that for some SY contracts, some redemption will involve withdrawing/redemption from external staking protocol or performing some swaps, which might suffer from some slippage.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/staking/protocols/PendlePrincipalToken.sol#L137
The
_redeemPT
function is being used in two places:Instance 1 - Within
_executeInstantRedemption
functionIf
TOKEN_OUT_SY == BORROW_TOKEN
, the code will accept anynetTokenOut
redeemed, even if it is fewer than expected due to slippage.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/staking/protocols/PendlePrincipalToken.sol#L140
Instance 2 - Within
_initiateWithdrawImpl
functionThe code will accept any
tokenOutSy
redeemed, even if it is fewer than expected due to slippage, and proceed to withdraw them from external protocols.https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/staking/protocols/PendlePrincipalToken.sol#L171
Impact
Loss of assets due to lack of slippage control. Slippage can occur naturally due to on-chain trading activities or the victim being sandwiched by malicious users/MEV.
Code Snippet
https://github.com/sherlock-audit/2024-06-leveraged-vaults/blob/main/leveraged-vaults-private/contracts/vaults/staking/protocols/PendlePrincipalToken.sol#L137
Tool used
Manual Review
Recommendation
Consider implementing the required slippage control.