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