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

Incorrect Function Call in StarklaneEscrow::_withdrawFromEscrow function, can lead to failure of the protocol

Summary

The incorrect function call for ERC1155 can cause the entire transfer process to fail or behave incorrectly, leading to unintended token transfers, transaction failures, and increased gas costs. This bug must be fixed to ensure that the function handles ERC721 and ERC1155 transfers correctly, according to the collectionType.

Vulnerability Details

The code block is incorrectly calling both ERC721 and ERC1155 transfer functions inside the same if condition. Specifically:

if (collectionType == CollectionType.ERC721) {
@> IERC721(collection).safeTransferFrom(from, to, id);
// TODO:
// Check here if the token supply is currently 0.
@> IERC1155(collection).safeTransferFrom(from, to, id, 1, "");
}

Impact

can cause the entire transfer process to fail or behave incorrectly

Tools Used

manual review

Recommendations

Fix the missing else statement for ERC1155

```diff
if (collectionType == CollectionType.ERC721) {
IERC721(collection).safeTransferFrom(from, to, id);
// TODO:
// Check here if the token supply is currently 0.
- IERC1155(collection).safeTransferFrom(from, to, id, 1, "");
}
+ else (collectionType == CollectionType.ERC1155) {
+ IERC1155(collection).safeTransferFrom(from, to, id, 1, "");
+ }
```
Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
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.