This repository has been archived by the owner on May 26, 2023. It is now read-only.
unforgiven - attacker can cause calls to claim function of the all Bounty types (except Ongoing) to revert because code would try to transfer refunded NFT deposits #250
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
unforgiven
high
attacker can cause calls to claim function of the all Bounty types (except Ongoing) to revert because code would try to transfer refunded NFT deposits
Summary
function claimNft() in BountyCore would try to transfer deposited NFT without checking the refund status of the deposit. attacker can use this and cause any bounty of all types (except Ongoing) to be unclaimable by making claim calls to revert because in claim code would loop through deposited NFT tokens and try to transfer them to winner and if one of deposited NFTs were refunded then the whole claim transaction would revert always.
Vulnerability Detail
Function
claimBounty()
in ClaimManagerV1 is used for claiming winner prize from Bounty contract. it calls appropriate claim method based on bounty type. the specific type bounty claim function would loop through bounty deposited NFT tokens and callclaimNft()
function of the bounty contract for that deposited NFT token.This is
_claimAtomicBounty()
code which is called byclaimBounty()
: (other claim functions for bounty types are similar)As you can see it loops through bounty deposited NFT tokens and calls
bounty.claimNft()
. This isclaimNft()
code in BountyCoreV1 contract:As you can see it calls
_transferNft()
without checking that the deposit is not refunded and_transferNft()
don't check that contract own the NFT token. so if one of the deposited NFT tokens were refunded then call toclaimNft()
for that refunded NFT deposit would revert and it would cause the whole claim to revert. as all Bounty types(except Ongoing) supports NFT deposit and claims, and the claim functions in the ClaimManagerV1 loops through the deposited NFTs and try to transfer them to winner so this issue exists for all the bounty types(except Ongoing) to exploit this attacker need to perform this:the issue exists for other type of the bounty (in tiered bounty attacker need to deposit NFT for a specific tier and then refund and claims for that tier would revert)
Impact
attacker can cause winners to not receive their prizes as claim function would always revert. attacker can perform this to every bounties if the type isn't Ongoing. this would cause fund lose for winner.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L150-L151
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L251-L254
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L320-L323
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L125-L136
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L257-L264
Tool used
Manual Review
Recommendation
check that NFT deposit is not refunded before calling transfer.
or check that contract owns the NFT before trying to transfer.
Duplicate of #263
The text was updated successfully, but these errors were encountered: