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
The function triggerEndEpoch can be called even when an epoch is considered null i.e., either premium or collateral vaults are empty.
Vulnerability Detail
An epoch is considered null if either premium or collateral vaults are empty. Currently, triggerNullEpoch() can be called to 1) zero out the claimTVL for the empty vault, and 2) set the claimTVL to finalTVL of the occupied vault. Essentially, this refunds the occupied vault.
However, it is possible to call triggerEndEpoch() when there is a null event. This is problematic because calling triggerEndEpoch(), will resolve as a non-depeg event has occurred. In other words, premium will be paid to collateral (fee will be assessed too). In this particular case, if the collateral vault is empty, the premium vault will lose all their deposits.
Impact
This is high impact because an adversary can front-run triggerNullEpoch() and call triggerEndEpoch() instead. This will result in lost funds. If there are no deposits into the collateral vault, premiums will be lost as there will be no one to withdraw. If it is a Carousel, emissions will be lost too.
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
ltyu
high
End epoch can be triggered when null epoch
Summary
The function
triggerEndEpoch
can be called even when an epoch is considered null i.e., either premium or collateral vaults are empty.Vulnerability Detail
An epoch is considered null if either premium or collateral vaults are empty. Currently,
triggerNullEpoch()
can be called to 1) zero out theclaimTVL
for the empty vault, and 2) set theclaimTVL
tofinalTVL
of the occupied vault. Essentially, this refunds the occupied vault.However, it is possible to call
triggerEndEpoch()
when there is a null event. This is problematic because callingtriggerEndEpoch()
, will resolve as a non-depeg event has occurred. In other words, premium will be paid to collateral (fee will be assessed too). In this particular case, if the collateral vault is empty, the premium vault will lose all their deposits.Impact
This is high impact because an adversary can front-run
triggerNullEpoch()
and calltriggerEndEpoch()
instead. This will result in lost funds. If there are no deposits into the collateral vault, premiums will be lost as there will be no one to withdraw. If it is a Carousel, emissions will be lost too.Code Snippet
No null epoch check in
triggerEndEpoch()
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Controllers/ControllerPeggedAssetV2.sol#L144-L202
Here is a test for it. Add to ControllerPeggedAssetV2Test.t.sol:
Tool used
Manual Review
Recommendation
Duplicate of #108
The text was updated successfully, but these errors were encountered: