The contract's _depositIntoEscrow
and _withdrawFromEscrow
functions transfer a fixed amount of 1
unit for ERC1155 tokens without verifying the actual token supply. This behavior can result in incorrect handling of tokens.
The vulnerability lies in the assumption that all ERC1155 tokens have a supply of 1
. This assumption is embedded in the following lines of code:
During deposit and withdrawal, the contract does not check the actual supply of the token, which can lead to mismanagement of the token's balance.
Impact:
Fungible Tokens: If a user deposits multiple units of a fungible ERC1155 token (e.g., 100 units), the contract only handles 1
unit, potentially leading to the loss or incorrect management of the remaining 99
units.
Non-Fungible Tokens: Non-fungible ERC1155 tokens, which should be unique and have a supply of 1
, may be mishandled if the contract does not properly verify and enforce this supply.
Manual Review
Implement checks within the _depositIntoEscrow
and _withdrawFromEscrow
functions to verify the actual supply of ERC1155 tokens.
Ensure that the contract correctly handles tokens with varying supplies, distinguishing between fungible and non-fungible tokens.
Example check to ensure the token supply is 1
:
```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(); } … } ```
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.