Skip to content
NFTVenue Ledger
Directory

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.

By Dr. Devon Kurosawa, PhDReview not recorded · Updated
ERC-1271 Smart-Contract Wallet Signatures: Cross-Safe & Cross-Chain Replay Defense — NFTVenue Ledger 2026 quantitative & supervisory data card
NFTVenue Ledger (EIP-712 Signatures, Permit2 Allowance Security, Royalties & Proxy Timelocks): Nested SafeMessage domain wrapping, 0x1626ba7e STATICCALL guards, and EIP-6492.Source: NFTVenue Ledger Institutional Research DeskLicense: CC-BY-4.0

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 holding 500 USDC) and Vault_B (the main treasury holding 10,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) constructs appDigest without hashing the wallet's address inside the inner struct—or suppose Vault_A and Vault_B are deployed via CREATE2 at the exact same address on Polygon and Ethereum Mainnet while an omnichain app omits chainId!
  • Inspect Permit2's PermitSingle EIP-712 struct definition: PermitSingle(PermitDetails details,address spender,uint256 sigDeadline)—owner is NOT inside PermitSingle's EIP-712 hashed struct (owner is passed separately in calldata to permit(address owner, PermitSingle, bytes sig)!)!
  • Read that again! Because PermitSingle does NOT include owner in hashStruct, appDigest for Vault_A and Vault_B on the same chain is 100% byte-for-byte IDENTICAL! If Vault_A and Vault_B merely check ECDSA.recover(appDigest, sig) == 0xAlice, Alice's signature authorizing 500 USDC on Vault_A replays verbatim against Vault_B to drain $10M!
Defensive Nested EIP-712 PersonalSign wrapper inside Safe and Coinbase Smart Wallet ERC-1271 validation
Defensive Nested EIP-712 PersonalSign wrapper inside Safe and Coinbase Smart Wallet ERC-1271 validationVerified Exhibit

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 / ExtensionPrimary CapabilityCritical Replay / Griefing TrapAudited Defense Requirement
Base ERC-1271 (0x1626ba7e)Deployed contract signature checkCross-Safe replay when dApp omits owner in structWallet must wrap hash in wallet's own EIP-712 domain!
EIP-7739 Typed RehashingPreserves hardware-wallet readabilityNaive nested hashing blinds user to inner dApp fieldsMerges dApp typed struct + Smart Account domain cleanly
EIP-6492 Counterfactual VerifyGasless login/orders pre-deploymentSide-effect execution in universal validator deployRun inside ephemeral reverted eth_call or off-chain verifier
Safe SignMessageLib On-ChainsignedMessages[msgHash] = 1Reverts if STATICCALL gas cap set too low (<20k)Callers must forward sufficient gas (never hardcode 5,000g)
EVM gas consumption of ERC-1271 signature verification across 1-of-1 ECDSA, 3-of-5 Safe, and P-256 Passkey
EVM gas consumption of ERC-1271 signature verification across 1-of-1 ECDSA, 3-of-5 Safe, and P-256 PasskeyVerified Exhibit

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:

Formula or model from the articleNot independently verified
Defensive Smart-Account Wrapped Digest (Blocks Cross-Vault & Cross-Chain Replay):
  • 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

Open Attribution License (CC BY 4.0)

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-safes

Regulatory Directory Cross-Reference

Referenced Institutions & Regulatory Registries

Primary Tier-1 Supervisory Registries

Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →

NFTVenue Ledger Data, Benchmarks & Contributor Records

ERC-1271 Smart Wallet Signatures & Safe Replay Defense | NFTVenue Ledger