Skip to content
Smart contracts Audit finding Intermediate

Position owner should set allowed slippage

The top-up action uses a default swap slippage of 5% and allows up to 40%, which lets malicious keepers or owners sandwich the swap and profit at the user's expense.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

TopUpAction.sol#L154 TopUpAction.sol#L187

The default swap slippage of 5% allows malicious keepers to sandwich attack topup. Additionally, up to 40% (_MINSWAPPERSLIPPAGE) slippage allows malicious owner to sandwich huge amounts from topup

Proof of Concept

Keeper can bundle swaps before and after topup to sandwich topup action, in fact it’s actually in their best interest to do so.

Recommended Mitigation Steps

Allow user to specify max swap slippage when creating topup similar to how it’s specified on uniswap or sushiswap to block attacks from both keepers and owners.

chase-manning (Backd) confirmed and resolved

gzeon (judge) commented:

According to C4 Judging criteria

Unless there is something uniquely novel created by combining vectors, most submissions regarding vulnerabilities that are inherent to a particular system or the Ethereum network as a whole should be considered QA. Examples of such vulnerabilities include front running, sandwich attacks, and MEV.

However since Backd use keeper to run topup transactions, which presumably are bots and smart contracts that can fetch onchain price directly. A large (5% default, up to 40%) seems excessive and can lead to user losing fund. Judging this as Medium Risk.


The original report as published on Code4rena, by 0x52. 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

A malicious keeper or owner could sandwich the top-up swap and cause the user to lose funds, though the judge noted sandwich attacks are generally low severity unless the slippage is excessive.

What the attacker needed

User creates a top-up; attacker can front-run and back-run the swap

The fix

The issue was resolved by allowing the user to specify a maximum swap slippage when creating a top-up.

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 a contract swaps tokens, it accepts a price within a slippage limit. If that limit is too wide, someone who sees the swap coming can trade just before and after it to move the price and take the difference. Here the limit was 5% by default and could be as high as 40%, so the attacker could take a large cut.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by 0x52

View all

211 more disclosed reports, best first.

More from Backd Tokenomics contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.