Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: medium
Valid

Management fees minting procedures during emergency withdrawal

Summary

The process of emergency withdrawal can last a long period and the mintFee function calling will decrease users' shares value each time. On the other hand if the mintFee function was called long before the emergency withdrawal started users receive more assets than should. This way the protocol management and other users lose shares value.

Vulnerability Details

The GMXVault.mintFee function can be called even if the vault is in the Closed status.

function mintFee() public {
_mint(_store.treasury, GMXReader.pendingFee(_store));
_store.lastFeeCollected = block.timestamp;
}

The _shareRatio calculation at the emergencyWithdraw function depends on totalSupply:

uint256 _shareRatio = shareAmt * SAFE_MULTIPLIER
/ IERC20(address(self.vault)).totalSupply();

In case the mintFee was called long before emergency withdrawal started users receive more assets than should.
In case someone calls mintFee during the emergency withdrawal users shares value continue to decrease but shouldn't.

Impact

Decreasing users' shares value / assets losses.

Tools used

Manual Review

Recommendations

Management fees should be minted before emergency withdrawal and then fees mining functionality should be blocked. Consider mintFee calling at the emergencyClose function and reverting at the mintFee function when the vault is in the Closed status. Another option for minting fees cancel is updating feePerSecond to zero value.

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

Disable mintFee during emergency

Impact: High Likelihood: Low Fee calculation must be stopped during an emergency. Typical problem that can happen for pausable protocols.

Support

FAQs

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