Skip to content
Smart contracts Audit finding Beginner

`Edition.supportsInterface` is not EIP1155 compliant

The Edition contract's supportsInterface function only returned the result of the more derived ERC2981 implementation, so it reported false for the mandatory ERC1155 interface identifiers. An integrator checking ERC1155 support would wrongly conclude the contract is not an ERC1155 token, breaking composability with marketplaces and other contracts.

CodeWasp Follow with ZdravkoHr., cducrest-brainbot and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-04-titles-judging/issues/287

Found by

CodeWasp, ZdravkoHr., cducrest-brainbot, xiaoming90

Summary

According to the ERC-1155 specification, the smart contracts that are implementing it MUST have a supportsInferface(bytes4) function that returns true for values 0xd9b67a26 and 0x0e89341c. The current implementation of Edition.sol will return false for both these values.

Vulnerability Detail

The contract inherits from ERC1155 and ERC2981.

Solidity
contract Edition is IEdition, ERC1155, ERC2981, Initializable, OwnableRoles

The supportsInterface() function of Edition returns the result of executing super.supportsInterface()

Solidity
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(IEdition, ERC1155, ERC2981)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

Since both ERC1155 and ERC2981 implement that function and ERC2981 is the more derived contract of the two, Edition.supportsInterface() will end up executing only ERC2981.supportsInterface().

Impact

Medium. The contract is to be a strict implementation of ERC1155, but it does not implement the mandatory ERC1155.supportsInterface() function.

Code Snippet

PoC for Edition.t.sol

Solidity
    function test_interface() public {
        assertFalse(edition.supportsInterface(bytes4(0xd9b67a26)));
        assertFalse(edition.supportsInterface(bytes4(0x0e89341c)));
    }

Tool used

Foundry

Recommendation

Instead of relying on super, return the union of ERC1155.supportsInterface(interfaceId) and ERC2981.supportsInterface(interfaceId).

Diff
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(IEdition, ERC1155, ERC2981)
        returns (bool)
    {
-       return super.supportsInterface(interfaceId);
+       return ERC1155.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
    }

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/titlesnyc/wallflower-contract-v2/pull/1

sherlock-admin2

The Lead Senior Watson signed off on the fix.

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

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 override used super.supportsInterface, which resolves to only the most derived parent (ERC2981) instead of combining both parents' answers.

Impact

The contract fails to meet the mandatory ERC1155 interface requirement, which could cause integrations that check interface support to reject or mishandle the token.

What the attacker needed

None

The fix

The team fixed it by returning the union of the ERC1155 and ERC2981 supportsInterface results instead of relying on super.

How it was found

  1. Call supportsInterface on the Edition contract with the ERC1155 interface identifier.
  2. Observe it returns false instead of true.
  3. Repeat with the ERC1155 metadata interface identifier and observe false again.

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.

A smart contract can advertise which standards it follows by answering a yes/no question with a special code. Here the contract answered 'no' to the ERC1155 token standard even though it is one, because its answer function only asked one of its two parent contracts. Other programs that check this answer would treat the token as incompatible.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by CodeWasp

View all

3 more disclosed reports, best first.

More from TITLES Publishing Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.