Skip to content
Smart contracts Audit finding Intermediate

No slippage protection on Uniswap swap

The contract's swap function hard-codes the minimum output amount to 1, so it accepts almost any price. An attacker could manipulate the pool price or front-run the swap so the contract receives nearly no tokens, causing a loss for the protocol.

Olas

Originally disclosed on Code4rena

Found by v12

autonolas-tokenomics/../contracts/utils/BuyBackBurnerBalancer.sol #L106

Targets

  • _performSwap (BuyBackBurnerBalancer)

Description

The function unconditionally sets amountOutMinimum to 1 when performing the Uniswap V3 swap. This allows the swap to execute even if the output amount is almost zero, leaving the contract unprotected against slippage or price manipulation.

Root cause

amountOutMinimum parameter in the Uniswap router call is hard-coded to 1 instead of deriving from configuration or validating the expected output.

Impact

An attacker can front-run or manipulate pool prices so that the contract receives almost no OLAS tokens in exchange for the input, leading to a loss of funds for the protocol.


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

Root cause

The minimum output amount for the Uniswap swap is hard-coded to 1 instead of being calculated from configuration or expected output.

Impact

An attacker could front-run or manipulate pool prices so the contract receives almost no OLAS tokens, leading to a loss of funds for the protocol.

What the attacker needed

Ability to manipulate pool price; swap function callable

The fix

The minimum output amount should be derived from configuration or validated against the expected output rather than being hard-coded to 1.

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 can set a minimum amount it is willing to receive. Here that minimum was set to 1, meaning the contract would accept almost nothing in return. Someone could take advantage of that by changing the price just before the swap, so the contract gets a very bad deal.

What is Smart contracts?

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

More from Olas

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.