Skip to content
Business logic Audit finding Beginner

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.

0x52 Follow

Originally disclosed on Sherlock

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

https://github.com/sherlock-audit/2022-10-rage-trade/blob/main/dn-gmx-vaults/contracts/periphery/WithdrawPeriphery.sol#L47

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

The original report as published on Sherlock, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by 0x52

View all

211 more disclosed reports, best first.

More from Rage Trade

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.