NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing ERC1155TokenReceiver Implementation in Bridge Contract

Risk is low because this feature is not enabled as of now.

Summary

The Bridge contract, which inherits from StarklaneEscrow, uses safeTransferFrom to receive ERC1155 tokens but fails to implement the required ERC1155TokenReceiver interface. This oversight can lead to failed token transfers and potential loss of user funds when attempting to bridge ERC1155 tokens.

Vulnerability Details

In the StarklaneEscrow contract, the _depositIntoEscrow function uses safeTransferFrom for ERC1155 tokens

https://github.com/Cyfrin/2024-07-ark-project/blob/8f4f71d8b6487c316334a7e427f888cda01c8cff/apps/blockchain/ethereum/src/Escrow.sol#L46

The safeTransferFrom function in ERC1155 standard requires the receiving contract to implement the ERC1155TokenReceiver interface, specifically the onERC1155Received function. However, the Bridge contract does not implement this interface, which will cause all ERC1155 token transfers to fail.

Impact

This vulnerability renders the bridge non-functional for ERC1155 tokens. Any attempt to bridge ERC1155 tokens will fail.

Tools Used

Manual code review

Recommendations

Implement the ERC1155TokenReceiver interface in the Bridge contract

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

invalid-ERC1155-not-in-scope

```compatibilities: Blockchains: - Ethereum/Starknet Tokens: - [ERC721](www.tokenstandard.com) ``` ``` function depositTokens( uint256 salt, address collectionL1, snaddress ownerL2, uint256[] calldata ids, bool useAutoBurn ) external payable { if (!Cairo.isFelt252(snaddress.unwrap(ownerL2))) { revert CairoWrapError(); } if (!_enabled) { revert BridgeNotEnabledError(); } CollectionType ctype = TokenUtil.detectInterface(collectionL1); if (ctype == CollectionType.ERC1155) { @> revert NotSupportedYetError(); } … } ```

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.