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

ERC1155 would cause issues

Summary

The StarklaneEscrow contract contains a vulnerability where if a different user deposits the same token ID for ERC-1155 tokens, the original depositor's ownership is overwritten. This leads to the loss of the initial depositor's ownership record, which could result in disputes or unintended loss of assets.

Vulnerability Details

The _depositIntoEscrow function handles the deposit of ERC-721 and ERC-1155 tokens into escrow. However, the current implementation does not account for the scenario where the same token ID of an ERC-1155 token is deposited by a different user. When this occurs, the mapping _escrow[collection][id] is updated to reflect the new depositor, effectively erasing the record of the original depositor.

This issue is particularly problematic for ERC-1155 tokens because they can represent fungible assets with multiple owners for the same token ID. The lack of a mechanism to track multiple depositors for the same token ID could lead to the original depositor losing their claim to the token if another user deposits the same ID.

_escrow[collection][id] = msg.sender;

This assignment does not check if the token ID is already in escrow by another user, leading to the overwriting of the depositor's address.

Impact

The impact of this vulnerability is high, especially for contracts dealing with ERC-1155 tokens. The original depositor can lose their ownership record, leading to potential loss of assets or legal disputes. In a worst-case scenario, the depositor could lose valuable tokens if the system does not recognize their claim when they attempt to withdraw their assets.

Tools Used

Recommendations

Implement a mechanism to track multiple depositors for the same ERC-1155 token ID. This could involve maintaining a list of depositors for each token ID or using a different structure that supports multiple owners for the same token ID.

mapping(address => mapping(uint256 => address[])) _escrow1155;
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.