Incorrect implementation of EIP- domain separat
The contract builds its EIP-712 domain separator using a type hash that does not match the expected domain type schema, so the separator is non-standard. The author states this does not directly introduce a security vulnerability but could cause signatures to fail validation externally and create mismatched assumptions between the contract and clients.
- Disclosed after under an hour
29002 - [SC - Insight] Incorrect implementation of EIP- domain separat...
Submitted on Mar 4th 2024 at 13:58:49 UTC by @cheatcode for Boost | eBTC
Report ID: #29002
Report type: Smart Contract
Report severity: Insight
Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
See below
Vulnerability Details
EIP-712 provides a standard for signing typed structured data in Ethereum smart contracts, using the concept of domain separation to prevent collisions and replay attacks.
A key component of validation is the domain separator, which uniquely identifies the specific contract and chain for message signing purposes. The domain separator is constructed from:
- DOMAIN_TYPEHASH: The keccak256 hash of the EIP-712 domain schema definition itself (the actual string types used like name, version etc.)
- Contract Specific Values: Domain values like name, version, chain ID and contract address.
In the current contract, the _TYPE_HASH variable used in the domain separator construction does not match the expected DOMAIN_TYPEHASH. Upon closer inspection, it is aligned closer to the hash of the full message type itself rather than the domain type schema.
Impact Details
While this does not directly introduce security vulnerabilities per se, it indicates a gap in properly differentiating between DOMAIN_TYPEHASH and actual message TYPEHASH as EIP-712 expects
References
Add any relevant links to documentation or code
Proof of Concept
This could lead to the following issues:
- Domain separators constructed incorrectly as per standards
- Signatures validated against such separators fail externally
- Mismatched assumptions between contract and clients
- Confusing for future audit and maintenance
Recommendations
- Introduce a properly defined DOMAIN_TYPEHASH constant
- Construct domain separator by passing DOMAIN_TYPEHASH and contract-specific values
- Optionally validate both DOMAIN_TYPEHASH and message TYPEHASH on chain
This will greatly improve standards compliance, clarity and future security.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract used the message type hash instead of a dedicated DOMAIN_TYPEHASH constant when constructing the EIP-712 domain separator.
Impact
The author states this does not directly introduce security vulnerabilities, but it could cause signatures to fail external validation and create mismatched assumptions between the contract and clients.
What the attacker needed
None
The fix
The report recommends defining a proper DOMAIN_TYPEHASH constant and constructing the domain separator from it plus the contract-specific values.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
EIP-712 is a way for contracts to check that a signed message really came from a specific contract on a specific chain. It does this by mixing in a 'domain separator', a value built from a fixed type description plus details like the contract address and chain ID. Here the fixed type description used was the wrong one, so the separator does not follow the standard and other software may reject signatures made for this contract.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.