Crypto winter
English

EIP-712 signature replay protection

Typed data makes intent easier to inspect but leaves application-level replay protection to the verifier.

Risk assessment

Typed data makes intent easier to inspect but leaves application-level replay protection to the verifier.

Mitigation

Bind the deployment and chain in the domain. Include action, nonce and expiry in signed data and consume the nonce before effects.

Solidity mitigation excerpt

bytes32 digest = _hashTypedDataV4(structHash);
require(SignatureChecker.isValidSignatureNow(owner, digest, signature), InvalidSignature());
require(block.timestamp <= expiry && nonce == nonces[owner], InvalidAuthorization());
nonces[owner]++;

Foundry · Regression check

In local fixtures, assert a used or expired authorization is rejected and a signature for one verifier is invalid at another.

Mitigation

Related topics

What should I verify first?

In local fixtures, assert a used or expired authorization is rejected and a signature for one verifier is invalid at another.

Primary reference