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 May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Feb 21, 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
Number of deposits can increase infinitely and prevent any refund
Summary
Every time a deposit is being made, the deposit is appended to an array and this array is iterated over when computing the locked funds for eventually computing the refundable volume. This could lead to a revert of any refund transaction if the number of deposits is too high because the array would have too many item to iterate over leading to too high gas costs.
Vulnerability Detail
In order to compute the volume to be refunded in the following snippet, the contract computes the locked funds by checking the expiry date of each deposit.
So a malicious user could just send many transaction with the smallest possible amount of a token in order to create many entries in the deposits and make the refunds revert. The amount required to perform the attack would probably be in the order of a few wei.
The issue does not apply to NFT deposits because they are limited to 5.
Impact
I set high because all users would be unable to get a refund. This can really degrade the image of the project if it happens even once because the funders would definitely be pissed off. They could ask the developer to refund afterwards but this would be at his or her good will...
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
clems4ever
high
Number of deposits can increase infinitely and prevent any refund
Summary
Every time a deposit is being made, the deposit is appended to an array and this array is iterated over when computing the locked funds for eventually computing the refundable volume. This could lead to a revert of any refund transaction if the number of deposits is too high because the array would have too many item to iterate over leading to too high gas costs.
Vulnerability Detail
In order to compute the volume to be refunded in the following snippet, the contract computes the locked funds by checking the expiry date of each deposit.
And the iteration is done here
However, anyone could just call
fundBoutyToken
as many times as needed to grow the array enough for the iteration over the deposits to revertSo a malicious user could just send many transaction with the smallest possible amount of a token in order to create many entries in the deposits and make the refunds revert. The amount required to perform the attack would probably be in the order of a few wei.
The issue does not apply to NFT deposits because they are limited to 5.
Impact
I set high because all users would be unable to get a refund. This can really degrade the image of the project if it happens even once because the funders would definitely be pissed off. They could ask the developer to refund afterwards but this would be at his or her good will...
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L54
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L21
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L172
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L341
Tool used
Manual Review
Recommendation
One of those solutions with a preference for the first one
Duplicate of #77
The text was updated successfully, but these errors were encountered: