If a user transfers Native Currency to deposit and the deposit process fails at GMX, and the 'afterDepositCancellation' function is called, the user will receive their native currency back. However, during the transfer, the user can also trigger a revert, which results in the deposit not being cancellable anymore, and the vault remains in the 'Deposit' state.
Here is a POC that shows the Vault has a stuck state in such a scenario:
Here is the Code for the attacker contract:
The PoC can be started with this command: forge test --match-test POC3 -vv
There is another instance of these bugs during the withdrawal. In the 'processWithdraw' function, the user can withdraw in the native currency and also revert it, which simply reverts the 'processWithdraw' and sets the state back to 'Withdraw'. So the vault is stuck at the withdraw state.
If this bug is exploited during the deposit, there is no other option but to call emergencyPause and then emergencyResume, which can only be triggered by an Owner with Multisig and timelock. So, it will take some time to resolve this issue. The same applies to withdrawals.
VSCode, Foundry
A revert during the transfer could be catched, and the tokens could simply be sent to the user in WNT format.
Impact: High Likelihood: High An attacker can repeatedly force the protocol to get stuck in a not-open status. This can happen on both deposit, withdraw callback for both successful execution and failures. Will group all similar issues.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.