You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 27, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
There is no check for zero TVL in triggerEndEpoch meaning that null epoch can be treated like a normal one
Vulnerability Detail
If any vault's TVL is zero the epoch is not considered valid and the funds are given back to depositors. No fees are taken and no balance transfers are made between the vaults. From triggerNullEpoch:
However, it is also possible to call triggerEndEpoch, because this function does not check whether there is a vault with 0 TVL. It will take fees and transfer premium to collateral vault. This is vastly different from triggerNullEpoch behavior.
Let's say the epoch is invalid because there are no deposits to collateral vault. If triggerEndEpoch is called, premium depositors lose their funds as those will be transferred to collateral vault. On the other hand, with triggerNullEpoch they would have gotten them back since the epoch would be marked invalid.
Impact
Premium depositors will not get their funds back in case of null epoch
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
libratus
medium
Missing null epoch check in
triggerEndEpoch
Summary
There is no check for zero TVL in
triggerEndEpoch
meaning that null epoch can be treated like a normal oneVulnerability Detail
If any vault's TVL is zero the epoch is not considered valid and the funds are given back to depositors. No fees are taken and no balance transfers are made between the vaults. From
triggerNullEpoch
:However, it is also possible to call
triggerEndEpoch
, because this function does not check whether there is a vault with 0 TVL. It will take fees and transfer premium to collateral vault. This is vastly different fromtriggerNullEpoch
behavior.Let's say the epoch is invalid because there are no deposits to collateral vault. If
triggerEndEpoch
is called, premium depositors lose their funds as those will be transferred to collateral vault. On the other hand, withtriggerNullEpoch
they would have gotten them back since the epoch would be marked invalid.Impact
Premium depositors will not get their funds back in case of null epoch
Code Snippet
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L232-L251
Tool used
Manual Review
Recommendation
Revert
triggerEndEpoch
if either of the vaults has no depositsDuplicate of #108
The text was updated successfully, but these errors were encountered: