Skip to content
Business logic Audit finding Intermediate

Missing slippage checks

The smart contract functions lacked minimum output amount checks, allowing an attacker to sandwich transactions and cause large slippage. An attacker with sufficient capital could force nearly 100% slippage.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel, also found by tensors

There are no minimum amounts out, or checks that frontrunning/slippage is sufficiently mitigated. This means that anyone with enough capital can force arbitrarily large slippage by sandwiching transactions, close to 100%. See issue page for referenced code.

Recommend adding a minimum amount out parameter. The function reverts if the minimum amount isn’t obtained.

verifyfirst (Spartan) acknowledge:

We acknowledge the issue for the protocol’s AMM, but if this becomes a large issue in the future, the router is easily upgradeable to include a minimum rate parameter.

SamusEldburg (Spartan) confirmed and disagreed with severity:

Have changed this to confirmed; even though we already were aware of it; we have discussed and are happy to add in a UI-handed arg for minAmount now rather than reactively in the future. Disagree with severity though; this wasn’t a problem with V1 at all.

ghoul-sol (Judge) commented:

I’ll keep high risk as sandwich attacks are very common and risk of getting a bad swap is real.

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

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

An attacker with enough capital could force arbitrarily large slippage, close to 100%, by sandwiching transactions.

What the attacker needed

Sufficient capital to sandwich; victim trades on the AMM

The fix

The protocol should add a minimum amount out parameter that reverts if the minimum is not obtained.

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 on a decentralised exchange, you can set a minimum amount you are willing to receive. Without that, someone can see your trade and place their own trades before and after yours to manipulate the price, causing you to get much less than expected. This is called a sandwich attack.

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 cmichel

View all

196 more disclosed reports, best first.

More from Spartan Protocol Contest

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.