Skip to content
Business logic Audit finding Intermediate

_transferNFTs() succeeds even if no transfer is performed

The NFT transfer function succeeds even when the token does not support ERC-721 or ERC-1155 interfaces, so the buyer pays but receives no NFT. An attacker could exploit this with a malicious contract or a non-compliant token to take the buyer's funds.

k Follow

Originally disclosed on Code4rena

Submitted by k, also found by 0x29A, 0xf15ers, 0xsanson, antonttc, hyh, PwnedNoMore, and zzzitron

If an NFT is sold that does not specify support for the ERC-721 or ERC-1155 standard interface, the sale will still succeed. In doing so, the seller will receive funds from the buyer, but the buyer will not receive any NFT from the seller. This could happen in the following cases:

  1. A token that claims to be ERC-721/1155 compliant, but fails to implement the supportsInterface() function properly.
  2. An NFT that follows a standard other than ERC-721/1155 and does not implement their EIP-165 interfaces.
  3. A malicious contract that is deployed to take advantage of this behavior.

Proof of Concept

https://gist.github.com/kylriley/3bf0e03d79b3d62dd5a9224ca00c4cb9

Recommended Mitigation Steps

If neither the ERC-721 nor the ERC-1155 interface is supported the function should revert. An alternative approach would be to attempt a transferFrom and check the balance before and after to ensure that it succeeded.

nneverlander (Infinity) confirmed and resolved:

Fixed in https://github.com/infinitydotxyz/exchange-contracts-v2/commit/377c77f0888fea9ca1e087de701b5384a046f760

HardlyDifficult (judge) commented:

If supportsInterface returns false for both 721 & 1155 then no NFT is transferred but funds are still sent to the seller.

A number of NFTs do not fully comply with the 721/1155 standards. Since the order is not canceled or the tx reverted, this seems like a High risk issue.


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

Likely the transfer function does not verify that the token implements the required ERC-721 or ERC-1155 interface before proceeding, so it silently does nothing while still completing the sale.

Impact

A buyer could pay for an NFT and receive nothing, and a malicious seller could exploit this to take funds without transferring any token.

What the attacker needed

Malicious or non-compliant NFT contract; buyer purchases the NFT

The fix

The function should revert if neither the ERC-721 nor ERC-1155 interface is supported, or alternatively check the balance before and after a transferFrom call to confirm success; the report states it was fixed.

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 buy an NFT, the marketplace should check that the NFT contract follows the standard rules (ERC-721 or ERC-1155) so it can actually transfer the token. Here, the check was missing or wrong, so the sale went through and the buyer's money was sent to the seller, but the NFT never moved. A malicious seller could use a fake contract to take the buyer's money without giving anything back.

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 Infinity NFT Marketplace 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.