Signature Replay Across Deployments, Chains and Encodings
An off-chain authorization scheme without a nonce or a complete EIP-712 domain lets one signature be spent again and again.
Signature-based authorization is only as safe as what the signature commits to. This demonstration covers three replay variants against one lab ledger, then shows a version that commits to signer, nonce, deadline, chain and contract.
criticalXV-DEMO-19 · Verified by testSigned messages have no nonce
Signed messages have no nonce
Description
The contract verifies the signer but never records the signature as used.
Impact
Anyone holding a signature can resubmit it indefinitely.
Recommendation
Include a per-signer nonce in the signed struct and increment it on use.
highXV-DEMO-20 · Verified by testSignature not bound to chain or contract
Signature not bound to chain or contract
Description
The signed payload omits chainId and the verifying contract, so it is valid on every deployment.
Impact
Signatures intended for one deployment or chain can be replayed on another.
Recommendation
Use a full EIP-712 domain, computed from block.chainid at verification time.
mediumXV-DEMO-21 · Verified by testMalleable signatures accepted via raw ecrecover
Malleable signatures accepted via raw ecrecover
Description
High-s signatures are accepted, so a second valid encoding exists for each signature.
Impact
Defeats any replay protection keyed on signature bytes.
Recommendation
Reject s values in the upper half of the curve order, and key replay protection on nonces.
Measured in the lab: a single 1-ETH transfer signature was spent three times on one vulnerable ledger (original, replay, malleated encoding) and once more on a second deployment.
On the fixed ledger the signature was accepted once; the replay, the malleated encoding, the second deployment, and a signature made for a different chain ID were all rejected. Cross-chain replay is simulated by signing for another chain ID on a single local network.
The lab code and tests for this case study live in labs/web3 of the Xevry website repository.
cd labs/web3npm installnpx hardhat test test/SignatureReplay.test.jsFiles: labs/web3/contracts/Signatures.sol · labs/web3/test/SignatureReplay.test.js
Let's discuss your security needs.
Tell us what you're building. We'll respond with clear questions, an honest view of whether we're the right fit, and a scoped proposal if we are.