Submitted by 0xAlix2, also found by web3km, zhaojohnson, Nyx, 0xbepresent, joaovwfreire, hash, pkqs90, and nnez
Users can use PositionAction::increaseLever to increase their positions leverage, i.e., increasing both the collateral and debt, by taking a flash loan and doing some swaps. At the end of the process, after swapping borrow tokens to underlying tokens they should be returned to the vault under the positions name.
For ERC20 collateral positions, this is happening in PositionAction20::_onIncreaseLever (that gets called in PositionAction::onFlashLoan) which approves the vault to spend some amount and then returns the amount to be later sent using the following in PositionAction::onFlashLoan:
However, for ERC4626 collateral positions, PositionAction4626::_onIncreaseLever is both approving the amount and depositing it into the vault under address(this) which IS NOT the positions proxy but PositionAction4626 contract as it is the flash loan callback function and isnt delegated like increaseLever. When _onIncreaseLever finishes, itll try to deposit the collateral AGAIN in the vault using this; which will for sure revert, as the approval was spent and no funds are left to make the deposit.
This will cause PositionAction4626::increaseLever to always revert and never work, blocking users from leveraging their positions.
In PositionAction4626::_onIncreaseLever, replace:
with:
DoS
amarcu (LoopFi) confirmed
