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
refundDeposit() can be DOSed. It calls getLockedFunds() which loops through all deposits that are made to the bounty. However, because depositing is permissionless and number of deposit is unbounded, refunds cannot be made if too many deposits are made.
Vulnerability Detail
refundDeposit() calls getLockedFunds() to calculate availableFunds for max amount of deposits that can be withdrawn.
In getLockedFunds(), we go through depList, which is all the deposits that has been made to the bounty. This list is unbounded as there is no limit on the number of deposits that can be funded. Having a list that is too large will cause refunds to revert, even if expiration has been reached.
function getLockedFunds(address_depositId)
publicviewvirtualreturns (uint256)
{
uint256 lockedFunds;
bytes32[] memory depList =this.getDeposits();
for (uint256 i =0; i < depList.length; i++) {
if (
block.timestamp<
depositTime[depList[i]] + expiration[depList[i]] &&
tokenAddress[depList[i]] == _depositId
) {
lockedFunds += volume[depList[i]];
}
}
return lockedFunds;
}
Impact
Depositors may not be able to refund deposits even if expiration has been made. In fact, a malicious user can deposit dust amounts to force the DOS state.
Consider adding a maximum limit on number of deposits that can be made for bounty, as well as enforcing a minimum amount that bounty accepts as deposit. Currently, we accept any amount > 0.
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
yixxas
high
refundDeposit()
can reach the out-of-gas stateSummary
refundDeposit()
can be DOSed. It callsgetLockedFunds()
which loops through all deposits that are made to the bounty. However, because depositing is permissionless and number of deposit is unbounded, refunds cannot be made if too many deposits are made.Vulnerability Detail
refundDeposit()
callsgetLockedFunds()
to calculateavailableFunds
for max amount of deposits that can be withdrawn.In
getLockedFunds()
, we go throughdepList
, which is all the deposits that has been made to the bounty. This list is unbounded as there is no limit on the number of deposits that can be funded. Having a list that is too large will cause refunds to revert, even if expiration has been reached.Impact
Depositors may not be able to refund deposits even if expiration has been made. In fact, a malicious user can deposit dust amounts to force the DOS state.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L333-L352
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L152-L195
Tool used
Manual Review
Recommendation
Consider adding a maximum limit on number of deposits that can be made for bounty, as well as enforcing a minimum amount that bounty accepts as deposit. Currently, we accept any amount > 0.
Duplicate of #77
The text was updated successfully, but these errors were encountered: