Skip to content
Smart contracts Audit finding Intermediate

Inconsistency between constructor and setting method for slippageTolerance

The constructor for a smart contract strategy did not enforce the same validation on the slippage tolerance parameter as the setter method did. An attacker could deploy or configure the contract with an invalid slippage tolerance, potentially causing trades to fail or execute at unfavourable prices.

fatherOfBlocks Follow

Originally disclosed on Code4rena

Submitted by fatherOfBlocks, also found by shenwilly

StrategySwapper.sol#L38-L43 StrategySwapper.sol#L109-L114

In the setSlippageTolerance(L119) method you have certain requirements to set slippageTolerance, but in the constructor you don’t.

Recommended Mitigation Steps

I would add the corresponding validations to the constructor.

chase-manning (Backd) confirmed and resolved


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

What the attacker needed

None

The fix

The constructor should include the same validation requirements as the setSlippageTolerance method.

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.

A smart contract has a setting for 'slippage tolerance', which controls how much price movement is allowed during a trade. The function that updates this setting checked that the value was reasonable, but the constructor (which sets the initial value) did not. This means the contract could start with a bad value, leading to failed trades or losses.

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 fatherOfBlocks

View all

3 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.