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
Malicious token can block tiered percentage bounty close
Summary
It might be impossible to close the tiered percentage bounty if any token balance calculation fails.
Vulnerability Detail
When closing the tiered percentage bounty competition it iterates over all the tokens and gets their respective balances:
function closeCompetition() external onlyClaimManager {
require(
status == OpenQDefinitions.OPEN,
Errors.CONTRACT_ALREADY_CLOSED
);
status = OpenQDefinitions.CLOSED;
bountyClosedTime =block.timestamp;
for (uint256 i =0; i <getTokenAddresses().length; i++) {
address _tokenAddress =getTokenAddresses()[i];
fundingTotals[_tokenAddress] =getTokenBalance(_tokenAddress);
}
}
The problem is that token.balanceOf might revert if a malicious token was inserted among other funds. This is highly possible because any token can be used unless the limit is reached:
If a malicious token that reverts on a certain balanceOf call, is inserted in the tiered percentage bounty funds, it will be impossible to close this bounty.
There are many possibilities. For example, you can try/catch and set the balance to 0 if it reverts, or get the balance only when claiming and allow specifying which tokens to claim.
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
HonorLt
high
Malicious token can block tiered percentage bounty close
Summary
It might be impossible to close the tiered percentage bounty if any token balance calculation fails.
Vulnerability Detail
When closing the tiered percentage bounty competition it iterates over all the tokens and gets their respective balances:
The problem is that
token.balanceOf
might revert if a malicious token was inserted among other funds. This is highly possible because any token can be used unless the limit is reached:Impact
If a malicious token that reverts on a certain
balanceOf
call, is inserted in the tiered percentage bounty funds, it will be impossible to close this bounty.Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L132-L135
Tool used
Manual Review
Recommendation
There are many possibilities. For example, you can try/catch and set the balance to 0 if it reverts, or get the balance only when claiming and allow specifying which tokens to claim.
Duplicate of #62
The text was updated successfully, but these errors were encountered: