Submitted by orangesantra, also found by EPSec and Evo
Anyone can call LamboRebalanceOnUniwap.sol::rebalance() function with any arbitrary value, leading to rebalancing goal i.e. (1:1 peg) unsuccessful.
The parameters required in rebalance() function will are, uint256 directionMask, uint256 amountIn, uint256 amountOut. The typical value should be -
directionMask = 0 or 1<<255
amountIn and amountOut obtained from LamboRebalanceOnUniwap.sol::previewRebalance()
But since there is no check, to ensure the typical values of parameter in the function, this can cause the flashloan for wrong amount or flashloan reverting if directionMask is any other value apart from 0 or 1<<255.
If flashloan of wrong amount occurs it means the pool will be unbalanced again with different value instead of balancing.
By pasting the following code in RebalanceTest.t.sol, we can see that after_uniswapPoolWETHBalance:2 and after_uniswapPoolVETHBalance:2 are much distant.
The test does the following -
But for second part output statement obtained is as follow (unable to obtain 1:1 peg)-
Paste the below code in RebalanceTest.t.sol.
Check the parameter of rebalance() function whether they are legit or not, i.e. as per flashloan requirement.
Shaneson (Lambo.win) acknowledged
