Volatile prices and lack of checks on rigidRedemption() can cause users to purchase stETH at unwanted prices
The rigidRedemption function lacks slippage protection, so a user's redemption can execute at a worse price than expected if the transaction is delayed. An attacker could exploit this by manipulating prices or delaying execution, causing the user to receive fewer tokens.
Submitted by Musaka
Impact
Volatile prices can cause issue when users try to do rigidRedemption.
Proof of Concept
Volatile prices can cause slippage loss when users use rigidRedemption(). This function takes PeUSD (stable coin) amount and converts it to WstETH/stETH (variable price). Unfortunately, rigidRedemption() does not include timestamp or minAmount received, meaning this trade can be executed later in time and at a different price than user previously expected.
Example:
- Provider has 100 wstETH and wstETH price is
$2000. - User wants to buy 10 wstETH and has 20,000 in PeUSD, so they calls
rigidRedemption. - Now, due to congestion on ETH and volatile prices, the transaction could remain stuck in the mempool for a long time.
- Finally, the transaction gets executed, but now the wstETH price is
$2100, not the original$2000, so the user receives 9.52 wstETH instead of 10 (not counting fees)!
Recommended Mitigation Steps
Because of this scenario and others like it, it is recommended to use some sort of slippage protection when users execute trades.
function rigidRedemption(address provider, uint256 eusdAmount,uint256 minAmountReceived) external virtual {
depositedAsset[provider] -= collateralAmount;
totalDepositedAsset -= collateralAmount;
+ require(minAmountReceived <= collateralAmount);
collateralAsset.transfer(msg.sender, collateralAmount);
emit RigidRedemption(msg.sender, provider, eusdAmount, collateralAmount, block.timestamp);
}
Assessed type
MEV
LybraFinance disagreed with severity and confirmed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the function lacks a minimum output amount parameter and deadline, allowing trades to execute at unfavourable prices.
Impact
Users could receive fewer tokens than expected due to price changes during transaction delay, resulting in slippage loss.
What the attacker needed
User calls rigidRedemption; network congestion delays transaction; price volatility
The fix
The function should be fixed by adding a minimum amount received parameter and a require check to enforce slippage protection.
How it was found
- Provider has 100 wstETH and wstETH price is $2000.
- User wants to buy 10 wstETH and has 20,000 in PeUSD, so they call rigidRedemption.
- Due to congestion on ETH and volatile prices, the transaction remains stuck in the mempool for a long time.
- Finally, the transaction gets executed, but now the wstETH price is $2100, not the original $2000, so the user receives 9.52 wstETH instead of 10.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you trade on a blockchain, the price can change between when you send your transaction and when it actually happens. This report shows a function that doesn't let you say 'don't execute if the price is worse than X', so you might get less than you bargained for. An attacker could take advantage of that delay to make you get a bad deal.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.