DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: high
Valid

`flow` storage variable does not reset to default value after completing the deposit flow causes DoS for users to Deposit and Withdraw

Summary

User cannot deposit or withdraw and keeper cannot call run() function when the flow is ongoing that is flow value != None. This value is set to default after every flow except in one case that will cause the DoS for the user and keeper.

Vulnerability Details

Consider the current state of the pool:

  1. positionIsClosed = false (Position is Open)

  2. beenLong = true (Position is Long)

  3. leverage = 1x (Hence _isLongOneLeverage(beenLong) = true)

Now user wants to deposit in this pool and calls deposit function with correct amount and sets the flow = DEPOSIT. pays the execution fee and set the nextAction.selector = INCREASE_ACTION.

Keeper will call runNextAction for _nextAction.selector = INCREASE_ACTION. and because of the above conditions of the pool _isLongOneLeverage(_isLong) this condition will be true and _runSwap() function will be called. Suppose the runSwap is called by the keeper with metadata length = 1 (Because of the optimized route). then it will call _doDexSwap() and swaps the tokens and finally _mint() is called and it calculates and assign the shares to the owner and here the flow ends. But after this flow ends flow variable is not reset to default that cause DoS for other user while deposit, withdraw and keeper cannot call run function because of _noneFlow() modifier which checks flow value should be default.

Impact

DoS for the user to deposit and withdraw. The keeper cannot call run().

Tools Used

Manual Review

Recommendations

Set flow value to default after the flow is finished.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_deposit_1x_long_dex_positionIsOpened_DoS_Flow

Likelihood: Medium/High, - Leverage = 1x - beenLong = True - positionIsClosed = False - Metadata → 1 length and Dex Swap Impact: Medium/High, DoS on any new action before the admin uses setVaultState Since this seems to be the most probable path for a 1x PerpVault, this one deserves a High.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!