MEV bots will steal from users due to an incorrectly manipulated value
The contract reduces the user-supplied minimum output amount by an additional slippage percentage, so swaps can return less than the user's stated minimum. MEV bots can exploit this to steal funds from users.
Honour Follow with RampageAudit, X77 and 2 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/41
Found by
Honour, RampageAudit, X77, future2_22, super_jack
Summary
MEV bots will steal from users due to an incorrectly manipulated value
Root Cause
Upon calling Zapper::_zap() to handle a transfer of a different token, we have the following code which is for a direct swap in a Uniswap V3 pool:
else {
_amountOut = _swapV3Single(_in, _getPoolFee(_poolInfo.pool1), _out, _amountIn, _amountOutMin);
}
The _amountOutMin is provided by the user as slippage. The issue is that upon calling _swapV3Single(), we have the following code:
uint256 _finalSlip = _slippage[_v3Pool] > 0 ? _slippage[_v3Pool] : _defaultSlippage;
...
DEX_ADAPTER.swapV3Single(_in, _out, _fee, _amountIn, (_amountOutMin * (1000 - _finalSlip)) / 1000, address(this));
As seen, the provided minimum amount is manipulated and decreased further.
Internal Pre-conditions
No response
External Pre-conditions
No response
Attack Path
- User provides 100 tokens to swap and wants at least 90 in return
- The 90 minimum tokens input is decreased by
_finalSlippercentage, resulting in the user receiving less than what he provided
Impact
Theft of funds from innocent users who have done nothing wrong
PoC
No response
Mitigation
Do not manipulate the value for users who provided a specific amount of minimum tokens to receive
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
Impact
MEV bots could steal funds from users by exploiting the reduced minimum output.
What the attacker needed
User performs a token swap via Zapper
The fix
The contract should not manipulate the user-provided minimum output amount.
How it was found
- User provides 100 tokens to swap and wants at least 90 in return
- The 90 minimum tokens input is decreased by _finalSlip percentage, resulting in the user receiving less than what he provided
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 swap tokens, you can set a minimum amount you are willing to receive. This code takes that minimum and makes it even lower, so you might get less than you agreed to. Attackers can take advantage of this to profit at your expense.
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.