Missing slippage protection when depositing to TokeAuto strategies leading to funds loss of the allocacted funds.
Vulnerability Details
The TokeAutoEth.sol and TokeAutoUSDStrategy.sol strategies are allocating funds to the AutopilotRouter and at this step the router returns amount of shares to be staked to the Rewarder contract, but the problem is that the deposit action to the AutopilotRouter has hardcoded 0 slippage value. The router deposit method is function depositMax(IERC4626 vault, address to, uint256 minSharesOut) and the minSharesOut is passed as 0 value:
This is a huge risk for the strategy to receive lesser amount of shares than the actual expected. Reasons could be many - manipulations of the totalSupply or a price oracle, sandwich attacks, protocol insolvency, etc. The strategy should protect the allocated funds at any cost and it should revert in the case of the router returning lesser shares than expected.
Impact Details
Allocated funds are at manipulation risk, because both strategies TokeAutoEth.sol and TokeAutoUSDStrategy.sol are not safe due to missing slippage protection. Impacted strategies:
Consider adding slippage protection for the both impacted strategies. The slippage should be defined off-chain and then passed to the smart contracts, because on-chain generated slippage is not fully secure.
Proof of Concept
Proof of Concept
Create test file src/test/strategies/TokeAutoETHStrategy.MissingSlippageProtection.t.sol and run the following command forge test src/test/strategies/TokeAutoETHStrategy.MissingSlippageProtection.t.sol -vv:
The PoC proves that after successful manipulation the strategy allocated funds are being stolen.