Skip to content
Business logic Audit finding Intermediate

The direct redeem fee can be circumvented

The random NFT selection during redemption occurs in the same transaction, allowing an attacker to revert if they do not receive the desired NFT. By using Flashbots, they can avoid paying fees for reverted transactions, thereby bypassing the direct redeem fee and potentially reducing earnings for other users.

NFTX contest

Originally disclosed on Code4rena

Since the random NFT is determined in the same transaction a payment or swap is being executed, a malicious actor can revert a transaction if they did not get the NFT they wanted. Combined with utilizing Flashbots miners which do not publish transactions which revert with FlashbotsCheckAndSend, there would be no cost to constantly attempting this every block or after the nonce is updated from getPseudoRand().

NFTXVaultUpgradeable.sol

Line 374: uint256 tokenId = i < specificIds.length
    ? specificIds[i]
    : getRandomTokenIdFromFund();

In this way, the directReedemFee can be avoided and users may lose out on potential earnings. The code below shows a transfer ownership of ERC20 tokens to attack the contract.

function revertIfNotSpecifiedID(uint256 targetTokenID) public {
    NFTXVaultUpgradeable vault = NFTXVaultUpgradeable(_vault);
    uint256[] resultID = vault.redeem(1,[]);
    require(resultID[0] == targetTokenID);
}

Recommend using a commit-reveal pattern for NFT swaps and redemptions.

0xKiwi (NFTX) acknowledged

cemozer (Judge) commented:

Leaving this as medium risk as it puts user earnings into risk

The original report as published on Code4rena. 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

Impact

This could allow attackers to bypass the direct redeem fee and potentially reduce earnings for other users, as acknowledged by the judge who rated it medium risk.

What the attacker needed

Access to Flashbots; ability to deploy a contract

The fix

The report recommends using a commit-reveal pattern for NFT swaps and redemptions.

How it was found

  1. Deploy a contract that calls the vault's redeem function.
  2. Check if the returned token ID matches the desired one; if not, revert the transaction.
  3. Use Flashbots to submit the transaction so that reverted attempts incur no cost.
  4. Repeat until the desired NFT is obtained.

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 you redeem an NFT from a vault, the system picks a random one for you. The report says an attacker can cancel the transaction if the random pick isn't what they want, and by using a special service that doesn't charge for cancelled transactions, they can keep trying for free. This lets them avoid a fee and take valuable NFTs, which could mean less profit for honest users.

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 from NFTX 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.