Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

warRoom - No check for zero TVL of either vault in triggerEndEpoch() leading to permanent freezing of funds #215

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

warRoom

high

No check for zero TVL of either vault in triggerEndEpoch() leading to permanent freezing of funds

Summary

When triggerEndEpoch() of ControllerPeggedAssetV2 is called, there is no check for zero TVL of either vault before resolving the epoch and transferring the funds to counterpartyVault

Vulnerability Detail

Where: ControllerPeggedAssetV2

Consider,

  • There is no depositor in collateralVault till beginEpoch time, So collateral TVL = 0.
  • There are depositors in premiumVault, so premium TVL > 0
  • No one has called triggerNullEpoch() till Epoch ends.
  • Now if someone calls triggerEndEpoch()
    • Epoch will be resolved
    • Funds from the premium vault will be transferred to the collateral vault but there is no collateral user to claim it. So, the funds are locked for this epoch in the collateral vault
    • Ideally, in such a scenario, premium vault users should have been able to claim their premium back (as it happens in triggerNullEpoch).

Note: We think in such scenarios, it is a huge liability for protocol and users to ensure calling triggerNullEpoch() before the trigger ends.

Impact

  • Permanent freezing of funds in the collateral vault, which is a loss for premium vault user

Code Snippet

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L144-L202

Tool used

Manual Review

Recommendation

  • Check if epoch qualifies for null epoch in triggerEndEpoch()

Duplicate of #108

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant