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

ast3ros - [M-5] Deposit fee can be bypassed by user #340

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed

ast3ros - [M-5] Deposit fee can be bypassed by user #340

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 High A valid High severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 27, 2023

ast3ros

medium

[M-5] Deposit fee can be bypassed by user

Summary

A user can bypass the deposit fee by depositing in the queue and immediately minting Deposit In Queue.

Vulnerability Detail

The Carousel is designed to charge a deposit fee when a depositor deposits directly. The deposit fee is calculated linearly based on the time between the epoch creation and the epoch start (later deposits pay higher fees). However, a user can deposit late without paying any deposit fee by:

  • Waiting until before the epoch start, queuing a deposit (Carousel.deposit) and minting Deposit In Queue (Carousel.mintDepositInQueue) immediately (this can be done atomically in one transaction).

A user can do it because:

Impact

Late depositors can exploit their informational advantage and avoid paying the deposit fee. This creates an unfair and unbalanced situation that allows them to profit at the expense of other depositors.

Code Snippet

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L495-L499
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L310-L355

Tool used

Manual Review

Recommendation

Some potential solutions are:

  • Apply the deposit fee to deposits in the queue as well.
  • Restrict the mintDepositInQueue function so that only authorized keepers can call it.

Duplicate of #75

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added High A valid High 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 High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant