This repository has been archived by the owner on May 26, 2023. It is now read-only.
bearonbike - Claim workflow does not update BountyStorageCore.volume which could lead to refund unworkable. #450
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Low/Info
A valid Low/Informational severity issue
Non-Reward
This issue will not receive a payout
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
bearonbike
high
Claim workflow does not update BountyStorageCore.volume which could lead to refund unworkable.
Summary
In BountyCore.getLockedFunds, BountyStorageCore.volume is accumulated as lockedfunds, and claim function of OngoingBounty does not deduct BountyStorageCore.volume.
If user claim some tokens, the BountyStorageCore.volume may be outdated and BountyCore.getLockedFunds could get wrong.
Since DepositManager.refundDeposit calculate specific token's availableFunds as all token's number minus locked token's number(i.e unexpired token number), then the result of availableFunds could be wrong.
If issuer close the bounty before refund, the funder can't make deposit refundable through extend it's expiration, fund could be stucked in a long time.
Vulnerability Detail
For example:
1, Alice mint an ongoingbounty
2, Bob funds 100 Link, set expiration to 10 days.
3, Dave deposit 200 Link, set expiration to 365 days.
4, 11 days have passed, Bob's deposite expired, should be able to refund.
5, Charlie claim 100 Link.
6, Alice close the bounty.
7, Bob try to refund first deposit, but receive nothing due to wrong value calculated by BountyCore.getLockedFunds.
8, Bob can't extend expiration of first deposit to make it refundable owing to bounty had been closed.
9, Bob can't get his money back due to he had already refund
Below is poc script, add it to DepositManager.test.js
Impact
Fund can't be returned.
Code Snippet
BountyCore.getLockedFunds
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L333-L352
DepositManager.refundDeposit
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L152-L195
Tool used
Manual Review
Recommendation
Update BountyStorageCore.volume when doing claim.
Duplicate of #256
The text was updated successfully, but these errors were encountered: