Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Domain separator is set wrongly, violates EIP712 specification

Summary

Domain separator is set wrongly, and does not follow EIP712 specs. It is missing chainId.

Vulnerability Details

This is EIP712Base._setDomainSeparator()

function _setDomainSeperator(string memory name, string memory version) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(version)),
> address(this),
> bytes32(getChainId())
)
);
}

In EIP-712, domain separator is set as name,version,chainId,verifying contract but in this protocol it is flipped. getChainId() is used as the salt instead of the chain id, which allows for replay attacks.

Impact

EIP specs is not followed, Signature will be hashed incorrectly with potential for replay and phishing attacks.

Tools Used

Manual Review

Recommendations

Swap chainId and address(this)

function _setDomainSeperator(string memory name, string memory version) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(version)),
+ bytes32(getChainId()),
+ address(this)
)
);
}

Also, change EIP712_DOMAIN_TYPEHASH to include chainID.

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.