WithdrawPeriphery uses incorrect value for MAX_BPS which will allow much higher slippage than intended
The WithdrawPeriphery contract used a MAX_BPS constant of 1000 instead of the standard 10000, causing slippage values to be ten times higher than intended. This could lead to unexpected slippage and loss of user funds, likely due to MEV.
Source: https://github.com/sherlock-audit/2022-10-rage-trade-judging/issues/39
Found by
0x52
Summary
WithdrawPeriphery accidentally uses an incorrect value for MAX_BPS which will allow for much higher slippage than intended.
Vulnerability Detail
uint256 internal constant MAX_BPS = 1000;
BPS is typically 10,000 and using 1000 is inconsistent with the rest of the ecosystem contracts and tests. The result is that slippage values will be 10x higher than intended.
Impact
Unexpected slippage resulting in loss of user funds, likely due to MEV
Code Snippet
Tool used
Manual Review
Recommendation
Correct MAX_BPS:
- uint256 internal constant MAX_BPS = 1000;
+ uint256 internal constant MAX_BPS = 10_000;
Discussion
0xDosa
Fix PR: https://github.com/RageTrade/delta-neutral-gmx-vaults/pull/40
0x00052
Fix looks good. Max_BPS has been updated
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
The contract defined MAX_BPS as 1000 instead of the standard 10000, making slippage limits ten times larger than intended.
Impact
Unexpected slippage could result in loss of user funds, likely due to MEV.
What the attacker needed
None
The fix
The MAX_BPS constant was corrected to 10000, and the fix was confirmed.
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.
In many financial contracts, a number called BPS (basis points) is used to set limits, where 10000 means 100%. Here, the contract used 1000 instead, so a slippage limit meant to be 1% became 10%. This means users could lose more money than they expected when withdrawing funds.
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.