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` labelHighA valid High severity issueRewardA payout will be made for this issue
The _mintShares function is utilized in _deposit, mintDepositInQueue, and mintRollovers. The problem is that the latter 2 functions execute the minting in a loop, e.g.:
while ((length - _operations) <= i) {
// this loop impelements FILO (first in last out) stack to reduce gas cost and improve code readability// changing it to FIFO (first in first out) would require more code changes and would be more expensive_mintShares(
queue[i].receiver,
_epochId,
queue[i].assets - relayerFee
);
emitDeposit(
msg.sender,
queue[i].receiver,
_epochId,
queue[i].assets - relayerFee
);
depositQueue.pop();
A malicious actor can write a custom recipient smart contract that does not revert on deposit but reverts when queue actions are executed. This way it will block the queue which is implemented in a FILO principle.
Impact
Anyone can block the queue with a custom smart contract that reverts.
There are many options, for example, allowing to skip certain items, performing the operation in a try/catch, or overriding the mint function to skip this check.
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` labelHighA valid High severity issueRewardA payout will be made for this issue
HonorLt
high
DOS queue minting of shares
Summary
A queue can be blocked if any of the recipient is a smart contract that reverts on
onERC1155Received
.Vulnerability Detail
When minting shares, it calls an internal
_mint
function:This function requires that if the recipient is a smart contract, it implements the
onERC1155Received
:The
_mintShares
function is utilized in_deposit
,mintDepositInQueue
, andmintRollovers
. The problem is that the latter 2 functions execute the minting in a loop, e.g.:A malicious actor can write a custom recipient smart contract that does not revert on deposit but reverts when queue actions are executed. This way it will block the queue which is implemented in a FILO principle.
Impact
Anyone can block the queue with a custom smart contract that reverts.
Code Snippet
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L334-L338
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L437
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L536
Tool used
Manual Review
Recommendation
There are many options, for example, allowing to skip certain items, performing the operation in a try/catch, or overriding the mint function to skip this check.
Duplicate of #468
The text was updated successfully, but these errors were encountered: