wrong YAXIS estimates
The Harvester.getEstimates function used a WETH input amount to compute a YAXIS to WETH trade, producing incorrect estimates. These wrong estimates could cause harvest transactions to revert or allow large slippage, enabling sandwich attacks.
Submitted by cmichel
The Harvester.getEstimates contract tries to estimate a YAXIS amount but uses the wrong path and/or amount.
It currently uses a WETH input amount to compute a YAXIS -> WETH trade.
address[] memory _path;
_path[0] = IStrategy(_strategy).want();
_path[1] = IStrategy(_strategy).weth();
// ...
_path[0] = manager.yaxis();
// path is YAXIS -> WETH now
// fee is a WETH precision value
uint256 _fee = _estimatedWETH.mul(manager.treasuryFee()).div(ONE_HUNDRED_PERCENT);
// this will return wrong trade amounts
_amounts = _router.getAmountsOut(_fee, _path);
_estimatedYAXIS = _amounts[1];
Impact
The estimations from getEstimates are wrong. They seem to be used to provide min. amount slippage values (_estimatedWETH, _estimatedYAXIS) for the harvester when calling Controller._estimatedYAXIS. These are then used in BaseStrategy._payHarvestFees and can revert the harvest transactions if the wrongly computed _estimatedYAXIS value is above the actual trade value. Or they can allow a large slippage if the _estimatedYAXIS value is below the actual trade value, which can then be used for a sandwich attack.
Recommended Mitigation Steps
Fix the estimations computations.
As the estimations are used in BaseStrategy._payHarvestFees, the expected behavior seems to be trading WETH to YAXIS. The path should therefore be changed to path[0] = WETH; path[1] = YAXIS in Harvester.getEstimates.
GalloDaSballo (judge) commented:
Price estimates on Uniswap are dependent on which side of the swap you’re making
Sponsor has mitigated in later PR
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
Likely the code used a WETH input amount to compute a YAXIS to WETH trade, instead of the correct WETH to YAXIS direction.
Impact
The wrong estimates could revert harvest transactions or allow a large slippage, which can then be used for a sandwich attack.
What the attacker needed
None
The fix
The path should be changed to WETH -> YAXIS in Harvester.getEstimates.
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 tried to guess how many tokens it would get when swapping, but it used the wrong token as the starting point. This made the guess wrong, which could either stop the swap from working or let an attacker take advantage of the price difference.
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.