Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

HonorLt - Dependant token transfers can block claims #435

Closed
github-actions bot opened this issue Feb 21, 2023 · 0 comments
Closed

HonorLt - Dependant token transfers can block claims #435

github-actions bot opened this issue Feb 21, 2023 · 0 comments
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

Comments

@github-actions
Copy link

github-actions bot commented Feb 21, 2023

HonorLt

high

Dependant token transfers can block claims

Summary

The claim process depends on all the token transfers to succeed. One revert can make the rewards unclaimable.

Vulnerability Detail

When claiming the bounty, it iterates over all the tokens and claims it one by one.

Atomic bounty:

function _claimAtomicBounty(
        ...
    ) internal {
        ...
        for (uint256 i = 0; i < _bounty.getTokenAddresses().length; i++) {
            ...
            uint256 volume = _bounty.claimBalance(
                _closer,
                _bounty.getTokenAddresses()[i]
            );
            ...
        }

        for (uint256 i = 0; i < _bounty.getNftDeposits().length; i++) {
            _bounty.claimNft(_closer, _bounty.nftDeposits(i));
            ...
        }
    }

Tiered percentage bounty:

    function _claimTieredPercentageBounty(
       ...
    ) internal {
        ...
        for (uint256 i = 0; i < _bounty.getTokenAddresses().length; i++) {
            uint256 volume = _bounty.claimTiered(
                _closer,
                _tier,
                _bounty.getTokenAddresses()[i]
            );
            ...
        }

        for (uint256 i = 0; i < _bounty.getNftDeposits().length; i++) {
              ...
                _bounty.claimNft(_closer, _depositId);
              ...
            }
        }
           ...
    }

Tiered fixed bounty:

 function _claimTieredFixedBounty(
        ...
    ) internal {
        ...
        for (uint256 i = 0; i < _bounty.getNftDeposits().length; i++) {
            bytes32 _depositId = _bounty.nftDeposits(i);
            if (_bounty.tier(_depositId) == _tier) {
                _bounty.claimNft(_closer, _depositId);
                ...
            }
        }
     ...
    }

When token address limit is not reached, anyone can fund any token:

    function fundBountyToken(
        ...
    ) external payable onlyProxy {
        ...
        if (!isWhitelisted(_tokenAddress)) {
            require(
                !tokenAddressLimitReached(_bountyAddress),
                Errors.TOO_MANY_TOKEN_ADDRESSES
            );
        }
       ...

A malicious actors can create their own token that reverts when the sender is not they, then fund the bounty to make the legitimate claims revert. there is no way to opt-out from tokens you want to skip when claiming. Even legitimate tokens may sometimes revert on certain conditions.

Impact

If any of the deposits, either ERC20 token or NFT reverts on transfer, the whole claim process will revert making it impossible to claim the bounty.

Code Snippet

https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L130-L134

https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L130-L134

https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/ClaimManager/Implementations/ClaimManagerV1.sol#L230-L235

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/DepositManager/Implementations/DepositManagerV1.sol#L45-L50

Tool used

Manual Review

Recommendation

Claim tokens should have opt-out option to exclude potentially malicious or not interesting rewards.

Duplicate of #62

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue labels Feb 21, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

1 participant