Submitted by MiloTruck, also found by MiloTruck, d3e4, adriro (1, 2), m_Rassska, and rvierdiiev
In VotiumStrategyCore.sol, the buyCvx() and sellCvx() functions call exchange_underlying() of Curves ETH / CVX pool to buy and sell CVX respectively:
VotiumStrategyCore.sol#L233-L240
VotiumStrategyCore.sol#L258-L263
As seen from above, exchange_underlying() is called with its _min_dy parameter as 0, which means the minimum amount of CVX or ETH to receive from the swap is effectively 0.
This isnt an issue when users interact with the AfEth contract, as its deposit() and withdraw() functions include a _minOut parameter which protects against slippage.
However, users that interact with the VotiumStrategy contract directly will not be protected from slippage when they call any of the following functions:
Should users call any of the functions listed above directly, they will be susceptible to sandwich attacks by attackers, which would reduce the amount of CVX or ETH received from the swap with curves pool.
Due to a lack of slippage protection in buyCvx() and sellCvx(), users that interact with the VotiumStrategy contract will be susceptible to sandwich attacks. This results in a loss of funds for them as they will receive less CVX or ETH for the same amount of funds.
Consider the following scenario:
In this scenario, Alice has sandwiched Bobs deposit() transaction for a profit, causing Bob to receive less CVX for his deposited ETH.
Consider adding a _minOut parameter to either buyCvx() and sellCvx(), or the following functions:
This allows the caller to specify a minimum amount they expect from the swap, which would protect them from slippage.
elmutt (Asymmetry) confirmed and commented:
0xleastwood (Judge) commented:
elmutt (Asymmetry) commented:
0xleastwood (Judge) commented:
Asymmetry mitigated:
Status: Mitigation confirmed. Full details in reports from d3e4 and adriro.
