Closed code423n4 closed 2 years ago
Conscious design decision, not a vulnerability; very uncommon pattern and (as indicated in the submission) can always create a new version that has it if it becomes a more common pattern
This is a limitation that isn't expected to impact many NFTs today. Lowering this to a Low severity and grouping with the warden's QA report #188
Lines of code
https://github.com/code-423n4/2022-05-opensea-seaport/blob/4140473b1f85d0df602548ad260b1739ddd734a5/contracts/lib/TokenTransferrer.sol#L220-L728 https://github.com/Chomtana/2022-05-opensea-seaport/blob/8b4009bc3d81fc753a0e8435470a22505f25c411/contracts/attack/DataRestrictedNFT721.sol#L1-L64 https://github.com/Chomtana/2022-05-opensea-seaport/blob/8b4009bc3d81fc753a0e8435470a22505f25c411/contracts/attack/DataRestrictedNFT1155.sol#L1-L28 https://github.com/Chomtana/2022-05-opensea-seaport/blob/8b4009bc3d81fc753a0e8435470a22505f25c411/test/index.js#L16210-L16363
Vulnerability details
Impact
DataRestrictedNFT (Both ERC721 and ERC1155) is not working with Seaport as seaport cannot send _data bytes on transfer
DataRestricted NFT
is a NFT that can only be transferred if and only if valid_data
bytes is specified. Seaport can't handle this kind of NFT at all cost because_data
bytes is not specified anywhere in struct. Moreover, TokenTransferrer is clearly hardcode 0x into _data field for ERC1155 safeTransferFromData restricted NFT has use case in GameFi where every transfer must be approved by the offchain backend. And it may has more use case in the future where centralized organization adopt NFT and wanted some centralized control on NFT changing hand.
You can find implementation of Data restricted NFT below
As a result, Seaport may loss flexibility to become singularity marketplace contract in the future as
DataRestricted NFT
can't be used with Seaport thus require new NFT marketplace contract to be developed independently of each organization.Proof of Concept
https://github.com/Chomtana/2022-05-opensea-seaport/blob/main/test/index.js#L16210-L16363
This testcase show that without extra data, the transfer is blocked
This testcase show that with a valid extra data bytes (0x1234 in this case) the transfer is permitted.
This testcase show that Seaport throw "Forbidden" for DataRestrictedNft1155
Tools Used
DataRestricted NFT
code for both ERC721 and ERC1155Recommended Mitigation Steps
But it may be gas consuming, alternative way is to deploy two separate version of Seaport. One which not support DataRestrictedNFT while another one supported it