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

twicek - Queued deposits can get stuck indefinitely in the deposit queue #63

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

twicek

medium

Queued deposits can get stuck indefinitely in the deposit queue

Summary

Queued deposits can get stuck indefinitely in the deposit queue. By taking advantage of this, an attacker can purposefully grief early users by freezing their funds in the contract.

Vulnerability Detail

The first users to deposit into the deposit queue will be the last to have their deposit minted because the loop in mintDepositInQueue implements a First In Last Out stack for deposits.

An attacker can spam the deposit queue with small deposits (with _assets >= relayerFee). Doing so, he can grief early depositors by queuing just enough deposits so that it becomes impossible to mint all queued deposit in one call to mintDepositInQueue due to out of gas revert. If someone calls mintDepositInQueue and mint X deposits, the attacker can back-run the transaction with the same exact number of deposits to make sure early depositors will never get their deposit minted.

Since there is no mechanism allowing users to remove queued deposits, early depositors will risk to have their deposited funds frozen in the contract as long as the attacker decides.

Impact

An attacker can grief early users by freezing their funds in the contract.

Code Snippet

_deposit

mintDepositInQueue

Tool used

Manual Review

Recommendation

Consider implementing a First In First Out stack for the queued deposits.

Duplicate of #174

@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