Skip to content
Business logic Audit finding Intermediate

Griefing attack on seller’s airdrop benefits

The airdrop allocation for a token is credited to the original minter and is not transferred when the token is sold. If the new owner burns or nukes the token, the original minter's airdrop amount is reduced, causing a loss to the seller.

ZanyBonzy Follow with Trooper, 0x3b and 10 others

Originally disclosed on Code4rena

Submitted by ZanyBonzy, also found by Trooper, 0x3b, Sabit, King_ (1, 2), _karanel, sl1, Shubham, 0xR360, inzinko, 0x0bserver, PetarTolev, AvantGard, and 0xJoyBoy03

https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L47

https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L148

https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L294

https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L329

Impact

TraitForge NFTs can be transferred and sold, but the new owner can burn or most likely nuke the token to reduce the the initial owner’s airdrop benefits.

Proof of Concept

When a user mints or forges a new token, they’re set as the token’s initialOwner and given airdrop benefits equal to the entropy of their newly minted token.

  function _mintInternal(address to, uint256 mintPrice) internal {
//...
    initialOwners[newItemId] = to;

    if (!airdropContract.airdropStarted()) {
      airdropContract.addUserAmount(to, entropyValue);
    }
  function _mintNewEntity(
    address newOwner,
    uint256 entropy,
    uint256 gen
  ) private returns (uint256) {
//...
    initialOwners[newTokenId] = newOwner;
//...
    if (!airdropContract.airdropStarted()) {
      airdropContract.addUserAmount(newOwner, entropy);
    }

    emit NewEntityMinted(newOwner, newTokenId, gen, entropy);
    return newTokenId;
  }

When burning, the entropy is then deducted from the initialOwner’s amount, but not removed when transfered or when the token is bought, which in another case could allow the owner to earn from minting airdrop and from token sale.

  function burn(uint256 tokenId) external whenNotPaused nonReentrant {
//...
    if (!airdropContract.airdropStarted()) {
      uint256 entropy = getTokenEntropy(tokenId);
      airdropContract.subUserAmount(initialOwners[tokenId], entropy);
    }
//...
  }

However, a transferred or sold token can still be nuked or burned which directly reduces the initial owner’s user amount causing loss of funds to the initial owner. Also by nuking, the nuker doesn’t lose as much in the griefing attack compared to burning the token.

  function nuke(uint256 tokenId) public whenNotPaused nonReentrant {
//...
    nftContract.burn(tokenId); // Burn the token
//...
  }

Runnable POC

The gist link here holds a test case that shows that airdrop amounts are not migrated to new owner during transfers/sales, and that by burning/nuking the token, the seller’s airdrop amount can be successfully reduced.

The expected result should look like this:

Note: to view the provided image, please see the original submission here.

Recommended Mitigation Steps

Recommend introducing a check in the burn function that skips reducing user amount if the caller is the NukeFund contract or not the initial owner.

TForge1 (TraitForge) confirmed and commented:

Great find. We want to keep only minters/forgers as airdrop receivers, but yes, if they transfer or sell and that next person nukes, the initialOwner will lose entropy from their airdrop amount. This will be a real issue.

Koolex (judge) increased severity to High

KupiaSec (warden) commented:

I think this issue is not valid.

The documentation regarding the airdrop states that:

In the event that a player ‘nukes’ an entity, the entropy allocated by that entity is removed.

This implies that the incentive should be removed when an entity is nuked. Even if the new entity holder performs the nuke, the entropy allocated to that entity should be removed. Since the incentive assigned to that entity does not transfer during ownership changes, the original owner remains responsible for its burning.

Therefore, I believe this should be considered either a design choice or potentially a user error.

dimulski (warden) commented:

Hey @Koolex thanks for the swift judging! The Airdrop contract is not within the scope of this audit. The TraitForge contract doesn’t inherit it, it just interacts with it in certain conditions - if the airdrop is started. Since all the logic that may cause some potential losses for the initial owner is in the Airdrop.sol contract, this issue is clearly out of scope and thus invalid.

ZanyBonzy (warden) commented:

@KupiaSec - from the docs

Everytime someone mints directly or forges to mint, they are recorded in the AirDrop Contract, alongside the entropy of the entity they minted. If they nuke, that allocation given by the entity is removed.

Keyword here is “they” meaning the person doing the minting or the forging. In this case, the nuker is the buyer (or someone that the token is transferred to), someone who didn’t do the minting nor the forging, and as a result, their actions shouldn’t have to affect the original minter.

@dimulski - I’d suggest reading the issue carefully again. The root cause is in the TraitForge/NukeFund contract, the fix is also in the NukeFund contract. The airdrop points just happen to be rewards being lost which is the impact.

dimulski (warden) commented:

There are no points without the Airdrop contract, so what exactly should be fixed if the contract where the point distribution logic and their potential value is determined, is out of scope? All the interactions with that contract should be considered OOS. This is not a USDC or some other ERC20 contract, the value of these points comes from the Airdrop contract. Feel free to check the SC verdict on this type of situations.

Koolex (judge) commented:

Given that:

  • The bug is in scope since mapping(uint256 => address) public initialOwners; is used to track minters and forgers. Without tracking, no one will get airdrops even if the airdrop contract is ready and implemented.
  • Loss of funds to initial owners.

I believe the issue stands as is.


The original report as published on Code4rena, by ZanyBonzy. 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 burn function deducts entropy from the initial owner's airdrop amount without checking whether the caller is the initial owner or the current owner.

Impact

The original minter loses airdrop benefits when a subsequent owner burns or nukes the token, and the attacker can cause this loss at low cost by nuking.

What the attacker needed

Victim mints or forges a token; victim transfers or sells the token; attacker owns the token; airdrop has not started

The fix

The burn function should skip reducing the user amount if the caller is the NukeFund contract or is not the initial owner.

How it was found

  1. A user mints or forges a token, becoming the initialOwner and receiving airdrop benefits.
  2. The user transfers or sells the token to another address.
  3. The new owner calls nuke or burn on the token.
  4. The burn function deducts the token's entropy from the initialOwner's airdrop amount.

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.

When someone creates a new NFT, they earn airdrop points based on the NFT's 'entropy'. If they later sell that NFT, the new owner can destroy it, and the system will subtract those points from the original creator, even though they no longer own the NFT. This means a seller can lose their earned rewards because of the buyer's action.

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 ZanyBonzy

View all

9 more disclosed reports, best first.

More from TraitForge

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.