Skip to content
Business logic Audit finding Intermediate

Rewards owed burned NFT in RewardDistributor.sol become irretrievable

When an NFT is burned, its owner becomes the zero address, so the reward distribution function tries to transfer tokens to that address. The ERC20 token used does not allow transfers to the zero address, causing the function to revert and permanently locking the rewards in the contract.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52, also found by kyteg

RewardDistributor.sol#L172-L210

Rewards owed burned NFT are permanently locked.

Proof of Concept

function _burn(uint256 _tokenId) internal {
    require(_isApprovedOrOwner(msg.sender, _tokenId), 'caller is not owner nor approved');

    address owner = ownerOf(_tokenId);

    // Clear approval
    approve(address(0), _tokenId);
    // Remove token
    _removeTokenFrom(msg.sender, _tokenId);
    emit Transfer(owner, address(0), _tokenId);
}

function _removeTokenFrom(address _from, uint256 _tokenId) internal {
    // Throws if `_from` is not the current owner
    assert(idToOwner[_tokenId] == _from);
    // Change the owner
    idToOwner[_tokenId] = address(0);
    // Update owner token index tracking
    _removeTokenFromOwnerList(_from, _tokenId);
    // Change count tracking
    ownerToNFTokenCount[_from] -= 1;
}

After an NFT is burned, owner of token is set to address(0).

    rewardToken.transfer(tokenowner, reward);

This causes issues in multiStakerClaim L208. GOLOM uses OZ’s implementation of ERC20 which doesn’t allow tokens to be sent to address(0). Because the “owner” of the burned NFT is address(0) multiStakerClaim will always revert when called for a burned NFT trapping rewards in contract forever.

Recommended Mitigation Steps

Implement a clawback clause inside the multiStakerClaim function. If the token is burned (i.e. owned by address(0)) the rewards should be transferred to different address. These rewards could be claimed to the treasury or burned, etc.

    if (tokenowner == address(0){
        rewardToken.transfer(treasury, reward);
        weth.transfer(treasury, rewardEth);
    }

0xsaruman (Golom) confirmed, but disagreed with severity and commented:

I think its QA because burning NFT means the owner doesn’t want anything to do with rewards or the NFT anymore.


The original report as published on Code4rena, by 0x52. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The reward distribution logic does not handle the case where the NFT owner is the zero address after burning, and the ERC20 token rejects transfers to that address.

Impact

Rewards owed to burned NFTs become permanently locked in the contract and cannot be claimed by anyone.

What the attacker needed

NFT must be burned; rewards must be owed to that NFT

The fix

The multiStakerClaim function should check if the token owner is the zero address and, if so, transfer the rewards to a treasury or burn them instead.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

An NFT is a digital collectible that can be destroyed (burned). When burned, the system marks it as owned by nobody (the zero address). The reward contract tries to send earned tokens to that nobody address, but the token itself refuses such transfers, so the transaction fails and the tokens stay stuck forever.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0x52

View all

211 more disclosed reports, best first.

More from Golom contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.