This repository has been archived by the owner on May 26, 2023. It is now read-only.
0xbepresent - User claim is compromised if the deposited NFT is refunded by the funder. #296
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Escalation Resolved
This issue's escalations have been approved/rejected
High
A valid High severity issue
Reward
A payout will be made for this issue
0xbepresent
high
User claim is compromised if the deposited NFT is refunded by the funder.
Summary
If one NFT is refunded before the user claim his bounty the ClaimManagerV1.sol::_claimAtomicBounty(), ClaimManagerV1.sol::_claimTieredPercentageBounty() and ClaimManagerV1.sol::_claimTieredFixedBounty() functions will be reverted because the NFT Deposits array is not decreased in the refund action.
Vulnerability Detail
The funder can fund the bounty with a NFT via DepositManagerV1.sol::fundBountyNFT() function. Then when the funder wants to refund his NFT he can do it with the DepositManagerV1.sol::refundDeposit() function. The problem is that BountyCore.sol::refundDeposit() function does not decrease the nftDeposits array.
The
nftDeposits
array is important because if there is an inconsistency in the FOR statement in the claim functions the claim functions will be reverted.Impact
The user can not claim his bounties that are still available in the contract.
I created a test in
ClaimManager.test.js
. Basically the funder put two NFT to the same tier winner, then the funder refunds one of his NFT and the winner can not claim one of the NFT that is still available.Test steps:
Code Snippet
The
ClaimManagerV1.sol::_claimAtomicBounty()
FOR statement:The
ClaimManagerV1.sol::_claimTieredPercentageBounty()
FOR statement:The
ClaimManagerV1.sol::_claimTieredFixedBounty()
FOR statement:The
BountyCore.sol::refundDeposit()
where thenftDeposits
array is not decreased.Tool used
Vscode
Recommendation
Decrease the
nftDeposits
array when there is a refund action.Duplicate of #263
The text was updated successfully, but these errors were encountered: