Submitted by camden, also found by robee
The attack here allows the attacker to prevent migrations.
The attack here is recoverable because we can just call buyFlanAndBurn (f it worked as expected) with SCX as the input token to buy Flan with the extra SCX, then run the migration again.
The attack here is simple:
My proof of concept test. You should be able to use this directly in the thig
https://gist.github.com/CamdenClark/b6841ac7a63e868d90eff7d9a40e3e0a
https://github.com/code-423n4/2022-01-behodler/blob/cedb81273f6daf2ee39ec765eef5ba74f21b2c6e/contracts/UniswapHelper.sol#L167
localSCXBalance is the SCX balance of the uniswap helper. https://github.com/code-423n4/2022-01-behodler/blob/cedb81273f6daf2ee39ec765eef5ba74f21b2c6e/contracts/UniswapHelper.sol#L163
But, the caller of stablizeFlan assumes that the rectangleOfFairness parameter is going to be equal to the amount of SCX that was sent
https://github.com/code-423n4/2022-01-behodler/blob/cedb81273f6daf2ee39ec765eef5ba74f21b2c6e/contracts/Limbo.sol#L234
The mitigation could be to do >= instead of == so sending tokens cant grief this.
Beyond this though, why do you need to pass in rectangleOfFairness if were requiring it to be a function of the localSCXBalance anyways? https://github.com/code-423n4/2022-01-behodler/blob/cedb81273f6daf2ee39ec765eef5ba74f21b2c6e/contracts/UniswapHelper.sol#L167
gititGoro (Behodler) acknowledged and commented:
Jack the Pug (judge) commented:
