Erc721 Erc1155 Eip712 Permit Security
ERC-1155 Batch Transfer Security: Mandatory Receiver Hooks, Array Mismatches & Gas-Bomb DoS
Unlike ERC-721, EIP-1155 omits non-callback transfers entirely—making mandatory onERC1155Received and onERC1155BatchReceived hooks prime vectors for return-bomb and batch-sweep DoS.

Gaming inventories, fractionalized RWA tranches, and open-edition art collections across our marketplaces directory—such as Basepaint, Avarik Saga, Art Blocks X Bright Moments, and Async Blueprints—overwhelmingly prefer EIP-1155 Multi-Token Contracts because transferring 50 distinct items in one safeBatchTransferFrom(from, to, ids, values, data) call saves up to 80% gas over 50 separate ERC-721 transfers.
Yet as detailed in our EIP-712, Permit2 & proxy security master guide, EIP-1155 contains two architectural surprises that repeatedly break NFT aggregators, lending liquidators, and custom token implementations: (1) EIP-1155 has NO transferFrom without callbacks—every single transfer triggers 0xf23a6e61 or 0xbc197c81 on contract recipients, and (2) custom safeBatchTransferFrom loops frequently introduce fatal Duplicate-ID Balance Overwrite Bugs!
Fatal Bug #1: Caching Balances Across Duplicate ids in safeBatchTransferFrom!#
Watch how custom gas-optimized ERC-1155 implementations get drained for infinite tokens in 1 transaction when developers rewrite OpenZeppelin's safeBatchTransferFrom loop carelessly:
- Suppose an attacker calls
safeBatchTransferFrom(attacker, attacker, [42, 42], [100, 100], "")passing the exact sameid = 42twice insideids! - If a developer reads
uint256 fromBal_i = _balances[42][from]; uint256 toBal_i = _balances[42][to];into memory arrays before the update loop (or cachestoBalwhenfrom == to!), iteration 1 writes_balances[42] = 100, and iteration 2 adds+100onto staletoBal_i(or skips subtracting twice)—doubling the attacker's token balance out of thin air on every call! - Mandatory Audit Invariant: Inside every
for (uint256 i = 0; i < ids.length; ++i)iteration, read and write storage_balances[id][from] -= valueand_balances[id][to] += valuesequentially per element, never caching across array indices, and strictly assertids.length == values.length!
Fatal Bug #2: Floor-Sweeper & Liquidation DoS (Gas Bomb + Return Bomb)#
Because EIP-1155 provides zero non-callback transfer function, what happens when a borrower locks an ERC-1155 asset inside a lending protocol (or lists the cheapest item on the floor against a 20-item aggregator sweep on Seaport) via a smart-contract address whose onERC1155Received executes invalid or returns 2,000,000 bytes of junk memory (Return-Data Bomb)?
- 63/64 Gas Griefing: High-level Solidity
to.onERC1155Received(...)forwards63/64of the transaction's entire remaining gas (EIP-150). If a marketplace aggregator wraps 20 floor items insidetry seaport.fulfillOrder(...) {} catch {}without capping forwarded gas, 1 malicious seller's contract burns98.4%ofgasleft, causing the outer aggregator transaction to run out of gas and revert all 19 honest sales! - Quadratic Memory Expansion ("Return Bomb"): Even if you cap
call{gas: 100_000}(...), high-level Soliditytry ... catch (bytes memory reason)automatically executesRETURNDATACOPYon the entire returned payload! An attacker uses100kgas inside the subcall to return a massive byte buffer that triggers quadratic memory expansion gas in the parent contract, blowing through the caller's remaining gas!
ERC-721 vs ERC-1155 Security & Marketplace Settlement Matrix#
| Security / Settlement Property | ERC-721 Single-Asset Standard | ERC-1155 Multi-Token Standard | Mandatory Marketplace / Vault Fix |
|---|---|---|---|
| Non-Callback Fallback Transfer? | Yes (transferFrom skips hook) | NO! Every transfer calls 0xf23a6e61 / 0xbc197c81 | Liquidations seize to Liquidator, never push to Borrower! |
| Duplicate Token IDs in Batch | Impossible (1 tokenId per call) | Allowed (ids = [7, 7]) | Never cache _balances in memory prior to loop! |
| Floor-Sweep Aggregator Poisoning | Seller ETH receive gas/return bomb | Seller ETH + Buyer/Seller 1155 hook bombs | Low-level Yul call(capGas, ...) with 0 returndata copy! |
| Partial-Fill Order Support | Indivisible (amount == 1) | Native fungible values (Seaport PARTIAL) | Enforce exact fraction divisibility (Seaport math) |
Quadratic EVM Memory Expansion ("Return Bomb") Cost Formula & Assembly Shield#
Why does copying M = 65,536 bytes (2,048 32-byte words) of malicious returndata destroy a parent contract's gas budget? Because EVM memory cost scales quadratically as floor(words^2 / 512) + 3 * words:
- Memory_Gas(W words) = 3 * W + floor( W^2 / 512 )
- Example: Child subcall uses MSTORE8 at offset 131,072 (W = 4,096 words = 128 KB) & RETURN(0, 131072):
- If parent executes high-level Solidity try/catch (auto-copies full 128 KB into parent memory):
- ParentCopyCost = 3*(4,096) + (4,096^2 / 512) + CopyWordsCost = 12,288 + 32,768 + 12,288 = 57,344+ unexpected gas!
- At 512 KB (W = 16,384): ParentCopyCost = 573,440 gas -> Instant Out-Of-Gas parent revert!
- 2) Bomb-Proof Inline Yul ERC-1155 Hook Verification:
- let success := call(hookGasCap, to, 0, ptr, calldataLen, 0x00, 0x20) // Pre-caps output write to EXACTLY 32 bytes at 0x00!
- let magicOk := and(success, and(gt(returndatasize, 0x1f), eq(mload(0x00), shl(224, 0xbc197c81))))
- // Zero RETURNDATACOPY of arbitrary buffers -> Return-Bomb cost = 0 gas!
Auditing Immutable vs Secretly Mutable Bytecode Next#
Even when an ERC-1155 or marketplace Conduit appears to have zero proxy admin on Etherscan, can a malicious deployer wipe its bytecode and redeploy a drainer at the exact same Ethereum address? Examine CREATE2 + SELFDESTRUCT traps next in CREATE2 metamorphic redeployment detection and ERC-721 callback reentrancy inside our EIP-712, Permit2 & Proxy Security hub.
Frequently asked questions
How does the duplicate-ID balance inflation bug happen in custom ERC-1155 contracts?
If a developer reads sender and receiver balances into memory arrays before the transfer loop, submitting safeBatchTransferFrom(me, me, [1, 1], [100, 100]) overwrites the updated balance with stale cached math and mints free tokens.
Why can a borrower freeze an ERC-1155 liquidation if the vault pushes collateral back?
Because ERC-1155 lacks a non-callback transferFrom, pushing excess ERC-1155 tokens back to a borrower contract lets the borrower revert inside onERC1155Received; vaults must hold surpluses in pull-claim escrows.
What is a Return-Data Bomb in NFT marketplace aggregators?
When an aggregator wraps external fills in Solidity try/catch (bytes memory reason), Solidity copies the entire revert buffer into memory; returning 256 KB–512 KB triggers quadratic memory gas costs that crash the entire sweep.
How does EIP-1155 enforce Checks-Effects-Interactions inside the standard itself?
The EIP-1155 specification explicitly mandates updating state balances and emitting TransferSingle/TransferBatch events BEFORE calling onERC1155Received or onERC1155BatchReceived.
Publication record
- Published
- November 13, 2026
- Updated
- November 14, 2026
- Author
- Dr. Devon Kurosawa, PhD
- Review
- Review not recorded
- Automated fact check
- Passed in the stored pipeline record
- Source URLs
- 3 recorded
AI assistance recorded: anthropic/claude-opus-4.6. This field does not establish human review or source verification.
Academic & Institutional Attribution
Cite This Research & Embed Live Data Card
Standard academic & institutional research paper citation format.
Dr. Devon Kurosawa, PhD. (2026, November 14). ERC-1155 Batch Transfer Security: Mandatory Receiver Hooks, Array Mismatches & Gas-Bomb DoS. NFTVenue Ledger. https://nftvenueledger.com/protocols/erc1155-batch-transfer-hook-gas-stipend-dos-marketplaceRegulatory Directory Cross-Reference
Referenced Institutions & Regulatory Registries
Top Regulated Institutions in This Coverage Slice
Primary Tier-1 Supervisory Registries
Related Erc721 Erc1155 Eip712 Permit Security & Institutional Briefings
Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →Erc721 Erc1155 Eip712 Permit Security
EIP-712 Typed Signatures, Permit2 Allowances, NFT Royalties & Proxy Timelocks: 2026 Security GuideErc721 Erc1155 Eip712 Permit Security
CREATE2 Metamorphic Contracts, Cancun EIP-6780 SELFDESTRUCT & Bytecode Provenance AuditsErc721 Erc1155 Eip712 Permit Security
EIP-7201 Namespaced Storage Layouts: Eliminating __gap Fragility in Upgradeable ProxiesErc721 Erc1155 Eip712 Permit Security
EIP-712 Domain Separator Engineering: Dynamic chainId Caching & Cross-Fork Replay DefenseErc721 Erc1155 Eip712 Permit Security
Uniswap Permit2 Security Audit: AllowanceTransfer vs SignatureTransfer & Witness PhishingErc721 Erc1155 Eip712 Permit Security
EIP-2612 ERC-20 Permit Audits: ecrecover Zero-Address, s-Malleability & Griefing FrontrunsErc721 Erc1155 Eip712 Permit Security
ERC-721 & ERC-1155 setApprovalForAll Security: Operator Blast Radius & Conduit IsolationErc721 Erc1155 Eip712 Permit Security
Seaport v1.6 Protocol Architecture: Conduits, Hook Zones & Bulk Order Merkle TreesCross Chain Bridge Validator Exploits
Bug Bounty Escrows, Immunefi Vaults & SEAL Whitehat Safe Harbor On-Chain Rescue ProtocolsCross Chain Bridge Validator Exploits
Restaked Bridge & Oracle AVSs (EigenLayer / Symbiotic): Slashing Math & Corruptible-Majority BoundsOnchain Wash Trading Market Abuse
Tarjan Strongly Connected Components (SCC) & Johnson Cycle Graphs for NFT Wash-Trade FilteringOnchain Wash Trading Market Abuse
Zero-Fee Token-Rebate Mining & Points Farming: NFT Marketplace Volume Distortion Mechanics
NFTVenue Ledger Data, Benchmarks & Contributor Records
CC BY 4.0 Open Data
Open Institutional Datasets (CSV / JSON) →
Download desk-compiled quantitative series & schemas.
2026 Reference Matrix
2026 Institutional Benchmarks & Thresholds →
Statutory capital, clearing, margin & rate conventions.
Editorial Records
Authors & Review Records →
View named contributors where those records are available.
Complete Index
Master Research & Dossier Archive →
Browse all published briefings by topic pillar & date.
