Erc721 Erc1155 Eip712 Permit Security
ERC-1271 Smart-Contract Wallet Signatures: Cross-Safe & Cross-Chain Replay Defense
When a user owns multiple Safe or ERC-4337 smart accounts controlled by the same EOA signer set, naive ERC-1271 implementations permit catastrophic cross-account and cross-chain replay.

Externally Owned Accounts (EOAs) hold private keys, whereas smart-contract wallets (Safe, Coinbase Smart Wallet, Kernel, Argent) hold zero private keys and therefore cannot produce raw secp256k1 ecrecover signatures directly. ERC-1271 bridges off-chain order books—such as the Seaport marketplace protocol and CoW Protocol batch auctions—to smart accounts via a single view interface: isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue), returning 0x1626ba7e on success.
Anchored in our EIP-712, Permit2 & proxy security master guide, dozens of custom smart accounts and modular validators introduced critical Cross-Account and Cross-Chain ERC-1271 Replay Vulnerabilities by validating raw hash against owner without re-wrapping the digest inside the wallet's own EIP-712 domain!
Anatomy of the Cross-Account ERC-1271 Replay Vulnerability!#
Watch how a seemingly innocent 5-line isValidSignature(bytes32 appDigest, bytes sig) implementation drains institutional treasuries:
- Suppose Treasury Manager Alice (
0xAlice) is the 1-of-1 (or 2-of-2) signer on two separate smart-contract wallets:Vault_A(a testing wallet holding500 USDC) andVault_B(the main treasury holding10,000,000 USDC). - Suppose a naive smart wallet implements:
if (ECDSA.recover(appDigest, sig) == owner) return 0x1626ba7e;! - Now suppose a protocol (
like Permit2 or a DEX Router) constructsappDigestwithout hashing the wallet's address inside the inner struct—or supposeVault_AandVault_Bare deployed viaCREATE2at the exact same address on Polygon and Ethereum Mainnet while an omnichain app omitschainId! - Inspect
Permit2'sPermitSingleEIP-712 struct definition:PermitSingle(PermitDetails details,address spender,uint256 sigDeadline)—owneris NOT insidePermitSingle's EIP-712 hashed struct (owner is passed separately in calldata to permit(address owner, PermitSingle, bytes sig)!)! - Read that again! Because
PermitSingledoes NOT includeownerinhashStruct,appDigestforVault_AandVault_Bon the same chain is 100% byte-for-byte IDENTICAL! IfVault_AandVault_Bmerely checkECDSA.recover(appDigest, sig) == 0xAlice, Alice's signature authorizing500 USDConVault_Areplays verbatim againstVault_Bto drain$10M!
Safe CompatibilityFallbackHandler, EIP-6492 & EIP-7739 Defensive Rehashing#
Safe's audited CompatibilityFallbackHandler and EIP-7739 (Readable Typed Signatures for Smart Accounts) defeat cross-vault replay by wrapping incoming appDigest inside encodeMessageDataForSafe(safeAddress, chainId, appDigest). Meanwhile, EIP-6492 solves a major onboarding friction across marketplaces in our marketplaces directory (like Basepaint, Azuki, and Beethoven X): validating signatures from counterfactual ERC-4337 wallets before their first on-chain deployment transaction by appending a magic suffix 0x64926492... containing (create2Factory, factoryCalldata, innerSig)!
Smart-Account Signature Standard Security Matrix#
| Signature Standard / Extension | Primary Capability | Critical Replay / Griefing Trap | Audited Defense Requirement |
|---|---|---|---|
Base ERC-1271 (0x1626ba7e) | Deployed contract signature check | Cross-Safe replay when dApp omits owner in struct | Wallet must wrap hash in wallet's own EIP-712 domain! |
| EIP-7739 Typed Rehashing | Preserves hardware-wallet readability | Naive nested hashing blinds user to inner dApp fields | Merges dApp typed struct + Smart Account domain cleanly |
| EIP-6492 Counterfactual Verify | Gasless login/orders pre-deployment | Side-effect execution in universal validator deploy | Run inside ephemeral reverted eth_call or off-chain verifier |
Safe SignMessageLib On-Chain | signedMessages[msgHash] = 1 | Reverts if STATICCALL gas cap set too low (<20k) | Callers must forward sufficient gas (never hardcode 5,000g) |
Nested Domain-Bound ERC-1271 Digest Construction Math#
Both wallet developers and protocol callers must verify exact ABI return length (returndata.length == 32) and exact 4-byte selector equality:
- Given external dApp EIP-712 digest h_app (e.g., Permit2 PermitSingle where owner is unhashed):
- WalletDomain = keccak256(abi.encode(DOMAINTYPEHASH, block.chainid, address(this)))
- WrappedHash = keccak256(concat(0x1901, WalletDomain, keccak256(abi.encode(SAFEMSGTYPEHASH, h_app))))
- Caller-Side Safe Verification Invariant (Solidity Assembly):
- bool ok = staticcall(gas, signerContract, abi.encodeWithSelector(0x1626ba7e, h_app, sig))
- valid = ok && (returndatasize >= 32) && (mload(returndata) == 0x1626ba7e00000000000000000000000000000000000000000000000000000000)
- Worked Permit2 Replay Prevention Test:
- User controls Vault1 (0x11..11) & Vault2 (0x22..22) on Ethereum (chainId = 1) with same Passkey K:
- h_app(PermitSingle 100k USDC) = 0x77aa...99 (IDENTICAL for both vaults!)
- WrappedHash(Vault1) = 0x3c18...f2 != WrappedHash(Vault2) = 0x9e40...b1 -> Cross-vault replay reverts 100%!
Interfacing ERC-1271 With ERC-4337 Bundlers & EIP-712 Callers#
Protocol routers calling SignatureChecker.isValidSignatureNow automatically branch on signer.code.length > 0 (barring an edge case introduced by EIP-7702!). Explore account-abstraction execution next in ERC-4337 EntryPoint & Paymaster validation griefing and EIP-7702 EOA code delegation security inside our EIP-712, Permit2 & Proxy Security hub.
Frequently asked questions
How can an ERC-1271 signature for Vault A replay on Vault B if EIP-712 already hashes verifyingContract?
verifyingContract in the dApp digest is the dApp contract (e.g., Permit2), NOT the user smart wallet! When dApps like Permit2 PermitSingle omit the user wallet address from the signed struct, two wallets sharing an EOA owner produce identical dApp digests unless the wallet re-wraps the hash.
Why must callers use STATICCALL when invoking ERC-1271 isValidSignature?
If a marketplace or router used regular CALL instead of STATICCALL, a malicious smart-contract wallet could mutate external state or reenter the marketplace mid-settlement during signature verification.
What is the exact magic value returned by a valid ERC-1271 signature check?
isValidSignature(bytes32,bytes) must return 0x1626ba7e (padded to 32 bytes in ABI encoding), which equals the 4-byte function selector of isValidSignature(bytes32,bytes) itself.
How does EIP-6492 verify signatures before a smart wallet is deployed on-chain?
EIP-6492 wraps the signature with the wallet CREATE2 factory address, deployment calldata, and magic suffix 0x6492... so verifiers can simulate counterfactual deployment inside eth_call and run ERC-1271.
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-1271 Smart-Contract Wallet Signatures: Cross-Safe & Cross-Chain Replay Defense. NFTVenue Ledger. https://nftvenueledger.com/protocols/erc-1271-smart-contract-wallet-signature-replay-across-safesRegulatory 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
ERC-4337 Account Abstraction Security: EntryPoint Storage Rules & Paymaster GriefingErc721 Erc1155 Eip712 Permit Security
EIP-7702 EOA Code Delegation Security: SetCode Tx Type 0x04, Sweeper Phishing & tx.originErc721 Erc1155 Eip712 Permit Security
ERC-5192 Minimal Soulbound NFTs: Non-Transferable KYC Badges, Wrapper Traps & RevocationErc721 Erc1155 Eip712 Permit Security
ERC-6551 Token-Bound Accounts (TBAs): State Nonce Frontrunning & Circular Ownership LocksErc721 Erc1155 Eip712 Permit Security
ERC-721 safeTransferFrom & onERC721Received Reentrancy: Max-Supply Bypass & Escrow DrainsErc721 Erc1155 Eip712 Permit Security
Blind-Signing Deprecation (eth_sign), Pre-Sign Transaction Simulation & EIP-7730 Clear SigningErc721 Erc1155 Eip712 Permit Security
ERC-1155 Batch Transfer Security: Mandatory Receiver Hooks, Array Mismatches & Gas-Bomb DoSCross Chain Bridge Validator Exploits
Merkle Tree Second-Preimage Attacks, abi.encodePacked Collisions & Bridge Proof ForgeryCross Chain Bridge Validator Exploits
ERC-7265 Smart-Contract Circuit Breakers: Rolling Outflow Rate Limiters & Delayed SettlementCross Chain Bridge Validator Exploits
L2 Sequencer Downtime Oracles: Chainlink Uptime Feeds, Grace Periods & L1 Force-InclusionCross Chain Bridge Validator Exploits
Foundry Stateful Invariant Fuzzing, Handler Ghost Variables & Halmos Symbolic Bytecode Proving
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.
