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
Unbounded loop in getLockedFunds could lead to griefing/DOS attack when user try claiming refunds via refundDeposit
Summary
Griefing/DOS attack is possible when a malcious actor makes multiple fake deposits through fundBountyToken. As for, each new deposit its generating a new depositId which later it appends to the deposits for the record. So whenever a legitmate user try claiming his deposit via refundDeposit, it could cause excessive gas usage in getLockedFunds and transaction reverted due to block gas limit.
Vulnerability Detail
Consider the attacker make a deposits of 1 Wei of token 5000 times (say) through fundBountyToken(), which increase the deposits count by 5000.
A legitmate user try claiming for his deposits by calling refundDeposit in the same bounty contract above, where it first calculate the availableFunds using the total tokenBalance and locked tokenBalance.
Currently attacker can deposit with same account address multiple times and for every deposit a new depositId is generated to kept that deposit records.
In BountyCore.sol for receiveFunds, We can make sure if funder has previously deposit, then there is no need to generate new depositId, just update it for the previous depositId and accordingly the expiration can be extended.
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
eyexploit
high
Unbounded loop in
getLockedFunds
could lead to griefing/DOS attack when user try claiming refunds viarefundDeposit
Summary
Griefing/DOS attack is possible when a malcious actor makes multiple fake deposits through
fundBountyToken
. As for, each new deposit its generating a newdepositId
which later it appends to thedeposits
for the record. So whenever a legitmate user try claiming his deposit viarefundDeposit
, it could cause excessive gas usage ingetLockedFunds
and transaction reverted due to block gas limit.Vulnerability Detail
fundBountyToken()
, which increase the deposits count by 5000.refundDeposit
in the same bounty contract above, where it first calculate theavailableFunds
using the total tokenBalance and locked tokenBalance.Hence, user funds got freezed into the contract and also no claims are refundable for any new deposits in future.
Impact
Permanent freezing of user funds and no claim on any future deposits.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L54-L56
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L38
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L171-L172
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L341-L349
Tool used
Manual Review
Recommendation
Currently attacker can deposit with same account address multiple times and for every deposit a new
depositId
is generated to kept that deposit records.In BountyCore.sol for
receiveFunds
, We can make sure if funder has previously deposit, then there is no need to generate newdepositId
, just update it for the previousdepositId
and accordingly the expiration can be extended.Duplicate of #77
The text was updated successfully, but these errors were encountered: