Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-02M: Improper Domain Separator Retrieval #321

Closed
cliffhall opened this issue Sep 12, 2022 · 0 comments · Fixed by #402
Closed

EIP-02M: Improper Domain Separator Retrieval #321

cliffhall opened this issue Sep 12, 2022 · 0 comments · Fixed by #402
Labels
bug Something isn't working

Comments

@cliffhall
Copy link
Contributor

EIP-02M: Improper Domain Separator Retrieval

Type Severity Location
Language Specific EIP712Lib.sol:L67-L72

Description:

The EIP712Lib contract contains functions that dynamically construct the currently valid domain separator (i.e. domainSeparator) yet when getDomainSeparator is invoked the last value stored to domainSeparator is retrieved instead. As evidenced in the ConfigHandlerFacet contract that initializes this value, the domainSeparator is assigned to once thus permitting cross-chain replay attacks to occur, a trait especially relevant with the upcoming Ethereum hard fork.

Impact:

As the domainSeparator currently remains the same regardless of whether the blockchain the contract was deployed in forked, it is possible for a signed EIP-712 payload that is submitted on the original chain to be replayed on the forked chain improperly.

Example:

/**
 * @notice Get the domain separator.
 */
function getDomainSeparator() private view returns (bytes32) {
    return ProtocolLib.protocolMetaTxInfo().domainSeparator;
}

Recommendation:

We advise a caching system to be used instead similarly to the draft EIP-712 implementation by OpenZeppelin whereby the domain separator is re-calculated on a need-to basis by comparing the current block.chainid and the one that the original domainSeparator was calculated in, allowing the separator to be re-calculated in case the chain IDs do not match (i.e. due to the PoW chain of Ethereum being used instead of the PoS one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant