MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: high
Invalid

No Slippage protection in `L2TokenReceiver::swap` Function Leading to Unexpected Transaction Outcomes

Summary

slippage vulnerability inherent in token swaps. Attackers exploit this vulnerability by initiating trades with large input amounts and specifying low output minimums. This allows them to manipulate the execution price, causing the actual trade price to deviate unfavourably from the expected price. As a result, attackers can potentially receive more tokens than anticipated, leading to financial losses for the contract and its users while destabilising the token swap mechanism.

Vulnerability Details

The slippage vulnerability in L2TokenReceiver::swap arises from the discrepancy between the expected and actual execution prices of trades. When users initiate swaps based on specified input and output amounts, market conditions may cause the actual trade execution price to deviate, resulting in slippage. This vulnerability can lead to failed transactions, as the received output amount may fall short of expectations, causing financial losses and impacting user experience.

Impact

The slippage vulnerability can have several significant impacts on users and the functionality of the protocol:

-Financial Losses: Users may experience unexpected losses due to receiving fewer tokens than anticipated during a swap, resulting in financial discrepancies and reduced asset value.
-Failed Transactions: Slippage can lead to failed transactions or incomplete swaps, disrupting user interactions and hindering the execution of essential functions within decentralized applications

Tools Used

I wrote a test to test for lack of. slippage protection in L2TokenReceive.test.ts to test

it('should execute swap without reverting with low amountOutMinimum', async () => {
// Set a very low amountOutMinimum to simulate slippage
const amountIn = 100;
const amountOutMinimum = 1; // Very low amountOutMinimum
// Swap tokens with low amountOutMinimum
await expect(l2TokenReceiver.connect(OWNER).swap(amountIn, amountOutMinimum))
.to.not.be.reverted;
});

Recommendations

The recommended mitigation to prevent Slippage :

  • Allow users to set slippage tolerances when initiating swaps.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.