Closed c4-bot-9 closed 7 months ago
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as primary issue
CoinbaseSmartWallet.sol inheriting ERC1271.so has had _domainNameAndVersion()
overridden and hardcoded. Additionally, CoinbaseSmartWallet.sol is upgradeable and will have domainSeparator() dynamically updated when need be:
The claim If, for instance, the contract owner decides to upgrade the contract and changes the name or version, the domain separator will continue to be calculated using the old values
is incorrect. Upgrading the contract will cause the new implementation of _domainNameAndVersion()
to be called and the new values to be returned.
3docSec marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/ERC1271.sol#L100-L111 https://github.com/code-423n4/2024-03-coinbase/blob/e0573369b865d47fed778de00a7b6df65ab1744e/src/SmartWallet/ERC1271.sol#L143
Vulnerability details
Impact
Possible discrepancies in signature validation.
Proof of Concept
In the
ERC1271
contract, thedomainSeparator()
function is responsible for calculating the domain separator used inEIP-712
compliant hashes. This domain separator is crucial for ensuring the integrity of signature validation processes. However, a vulnerability arises due to the reliance of thedomainSeparator()
function on thename
andversion
returned by an internal function_domainNameAndVersion()
.Let's delve into the code snippet to understand the vulnerability more deeply:
In this function:
name
andversion
are obtained by calling_domainNameAndVersion()
.name
orversion
returned by_domainNameAndVersion()
changes after deployment, the domain separator will still be calculated using the old values. This inconsistency in the domain separator calculation can lead to discrepancies in signature validation.The
_domainNameAndVersion()
function is abstract and must be implemented by inheriting contracts. It typically returns thename
andversion
of the signing domain. If, for instance, the contract owner decides to upgrade the contract and changes the name or version, the domain separator will continue to be calculated using the old values. This can result in signature validation failures or unexpected behavior in contracts relying on the ERC1271 functionality.Tools Used
Manual
Recommended Mitigation Steps
Ensure that the name and version used for calculating the domain separator are immutable after deployment.
Assessed type
Context