The emergencyPause
function in the GMX smart contract can be called by the keeper at any time without pre-transaction checks. In some cases this could result in financial loss for users if the function is executed before the callbacks have executed.
The emergencyPause function lacks a control mechanism to prevent execution before callbacks execution. While it is designed to halt all contract activities in an emergency, its unrestricted execution could disrupt ongoing transactions. For example, if a user calls a function like deposit which involves multiple steps and expects a callback, and emergencyPause is invoked before the callback is executed, the user might lose his funds as he will not be able to mint svTokens.
Since emergencyPause
updates the state of the Vault to GMXTypes.Status.Paused
, when the callback from GMX executes the afterDepositExecution
nothing will happen since the conditions are not met. Which means that any deposit amount will not be met by a mint of svTokens.
If by any chance, the processDeposit
function is executed (or any other function from the callback) it will still revert in the beforeChecks (like the beforeProcessDepositChecks
).
If the emergency pause is triggered at an inopportune time, it could:
Prevent the completion of in-progress transactions.
Lead to loss of funds if the transactions are not properly rolled back.
Erode user trust in the system due to potential for funds to be stuck without recourse.
You can copy this test in the file GMXEmergencyTest.t.sol then execute the test with the command forge test --mt
Manual review
To mitigate this risk, the following recommendations should be implemented:
Introduce a state check mechanism that prevents emergencyPause from executing if there are pending critical operations that must be completed to ensure the integrity of in-progress transactions.
Implement a secure check that allows emergencyPause to queue behind critical operations, ensuring that any ongoing transaction can complete before the pause takes effect.
Impact: High Likelihood: Low/Medium Deposit or withdraw that were in progress will be ignored and cause fund loss. Because emergencyPause is only callable by keepers, Medium is the proper severity.
Impact: High Likelihood: Low/Medium Deposit or withdraw that were in progress will be ignored and cause fund loss. Because emergencyPause is only callable by keepers, Medium is the proper severity.
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.