The toTypedMessageHash function in the EIP712Base contract incorrectly implements the message formatting for EIP-712 signatures. Specifically, this function hashes the message using keccak256 over an incomplete EIP-191 prefix (\x19\x01) without including the message length, which violates the EIP-191 specification. This issue can affect the validity of signatures and reduce interoperability with off-chain systems expecting compliance with EIP-191 and EIP-712 standards.
The issue lies in the toTypedMessageHash function, which is responsible for creating a hash of the message in an EIP-712 compatible format. According to EIP-191, the message should include the length of the message being signed as part of the prefixed data. The current implementation omits this step, which leads to non-compliance with the standard.
In this code, \x19\x01 is used as a prefix to mark the message as an EIP-191 signed message. However, the message length is missing from the encoding. The correct approach, according to EIP-191 and EIP-712, is to include the message length in the signed data. This issue could lead to signatures being invalid or non-compliant with third-party tools or libraries designed for EIP-191.
Non-compliance with EIP-191 and EIP-712 can cause issues with third-party systems such as wallets, dApps, or other smart contracts that expect the correct message format, potentially causing failures in signature verification.
Manual Review
Include Message Length in toTypedMessageHash Function: Modify the toTypedMessageHash function to include the length of the message being signed, as required by EIP-191. The revised function should look like this:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.