Skip to content
Business logic Audit finding Intermediate

ERC1155Fuse : _transfer does not revert when sent to the old owner

The ERC1155Fuse contract's _transfer function returns early when the recipient is already the token's owner, so safeTransferFrom does not revert even if the sender's balance is insufficient. This violates the ERC-1155 standard and could mislead other contracts into assuming a transfer occurred.

zzzitron Follow

Originally disclosed on Code4rena

Submitted by zzzitron

The safeTransferFrom does not comply with the ERC1155 standard when the token is sent to the old owner.

Proof of Concept

According to the EIP-1155 standard for the safeTransferFrom:

MUST revert if balance of holder for token _id is lower than the _value sent.

Let’s say alice does not hold any token of tokenId, and bob holds one token of tokenId. Then alice tries to send one token of tokenId to bob with safeTranferFrom(alice, bob, tokenId, 1, ""). In this case, even though alice’s balance (= 0) is lower than the amount (= 1) sent, the safeTransferFrom will not revert. Thus, violating the EIP-1155 standard. It can cause problems for other contracts using this token, since they assume the token was transferred if the safeTransferFrom does not revert. However, in the example above, no token was actually transferred.

// wrapper/ERC1155Fuse.sol::_transfer
// ERC1155Fuse::safeTransferFrom uses _transfer

274     function _transfer(
275         address from,
276         address to,
277         uint256 id,
278         uint256 amount,
279         bytes memory data
280     ) internal {
281         (address oldOwner, uint32 fuses, uint64 expiry) = getData(id);
282         if (oldOwner == to) {
283             return;
284         }

Recommended Mitigation Steps

Revert even if the to address already owns the token.

jefflau (ENS) confirmed and commented:

Recommend severity QA.

LSDan (judge) commented:

I’m going to leave this as Medium. This issue could definitely impact other protocols and potentially cause a loss of funds given external factors.


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

Other contracts that assume a non-reverting safeTransferFrom means tokens moved could be misled, potentially causing loss of funds.

What the attacker needed

Sender has insufficient token balance; recipient is already the token owner

The fix

The _transfer function should revert when the recipient already owns the token instead of returning early.

How it was found

  1. Have alice hold zero tokens of a given tokenId and bob hold one token of that tokenId.
  2. Call safeTransferFrom from alice to bob for one token of that tokenId.
  3. Observe that the call does not revert despite alice's zero balance.

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.

ERC-1155 is a token standard where a transfer function must fail if the sender does not have enough tokens. Here, the contract skips that check when the receiver already owns the token, so a transfer that should fail appears to succeed. Other programs relying on that success signal may act as if tokens moved when they did not.

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 zzzitron

View all

21 more disclosed reports, best first.

More from ENS

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.