This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
carrot - Bounties can be broken by funding them with malicious ERC20 tokens #62
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
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
Comments
github-actions
bot
added
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
labels
Feb 21, 2023
This was referenced Feb 22, 2023
Closed
Closed
Closed
This was referenced Feb 22, 2023
Closed
Closed
FlacoJones
added
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
labels
Feb 22, 2023
Will fix by implementing an explicity token whitelist |
This was referenced Mar 7, 2023
XKET - An attacker can prevent claimers from claiming for atomic and tiered percentage bounties
#538
Closed
Lead Senior Watson comment on PR #113:
Lead Senior Watson comment on PR #116:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
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
Bounties can be broken by funding them with malicious ERC20 tokens
Summary
Any malicious user can fund a bounty contract with a malicious ERC20 contract and prevent winners from withdrawing their rewards.
Vulnerability Detail
The
DepositManagerV1
contract allows any user to fund any bounty with any token, as long as the following check passes infundBountyToken
functionhttps://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L45-L50
This check always passes as long as
tokenAddressLimitReacehd
is false, which will be the case for most cases and is a reasonable assumption to make.The claims are handled by the
claimManagerV1
contract, which relies on every single deposited token to be successfully transferred to the target address, as can be seen with the snippet below, taken from the function_claimAtomicBounty
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L123-L134
and the
claimBalance
function eventually ends up using thesafeTransfer
function from the Address library to carry out the transfer as seen inBountyCore.sol:221
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L221-L228
However, if any of the tokens end up reverting during the
safeTransfer
call, the entire claiming call is reverted. It is quite easy for an attacker to fund the bounty with such a malicious contract, and this would essentially brick the bounty preventing the claims from being processed. This will also lock up the funds in the contract until expiry, which can be an indefinite amount of time.This attack can be carried out in the following bounty types:
by using malicious ERC20 tokens following the same attack vector.
Impact
Bricking of bounty and lock up of funds until expiry timestamp
Code Snippet
The attack can be recreated using the following test snippet
Where the
mockBAD
token is defined as follows, with a malicious blacklist:Tool used
Hardhat
Manual Review
Recommendation
Use a try-catch block when transferring out tokens with
claimManager.sol
. This will ensure that even if there are malicious tokens, they wont revert the entire transaction.The text was updated successfully, but these errors were encountered: