This repository has been archived by the owner on May 26, 2023. It is now read-only.
carrot - Function closeCompetition()
in TieredBountyPercentage
contract can be bricked, stopping claims
#84
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
carrot
high
Function
closeCompetition()
inTieredBountyPercentage
contract can be bricked, stopping claimsSummary
The function
closeCompetition()
in contractTieredBountyPercentage
is called when a claim is made. This function however makes unsafe external calls which, if it reverts, can stop the funds from being claimed.Vulnerability Detail
The function
closecompetition
is defined as shownhttps://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L123-L136
This function is crucial for the claiming process, since if this function reverts, the claims do not go through.
This function calls
getTokenBalance
, which ends up calling the contract at _tokenAddress to check the balancehttps://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L275-L286
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L291-L299
A user can deposit the contract with a malicious token contract, and make the
balanceOf()
call revert when the bounty contract tries to call it. This will stop the claims process and break the bounty.Impact
Broken bounty contract where winners are unable to claim their prize tokens/Nfts
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L123-L136
Tool used
Manual Review
Recommendation
Make external calls such as
balanceOf()
inside a try-catch block, to prevent unintended reverts.Duplicate of #62
The text was updated successfully, but these errors were encountered: