The variable DOMAIN_SEPARATOR_TYPEHASH in SmartAccount.sol is cached in the contract storage and will not change after the contract is initialized. However, if a hard fork happens after the contract deployment, it would become invalid on one of the forked chains due to the block.chainid has changed.
Lines of code
https://github.com/code-423n4/2023-01-biconomy/blob/main/scw-contracts/contracts/smart-contract-wallet/SmartAccount.sol#L42
Vulnerability details
Impact
The variable
DOMAIN_SEPARATOR_TYPEHASH
inSmartAccount.sol
is cached in the contract storage and will not change after the contract is initialized. However, if a hard fork happens after the contract deployment, it would become invalid on one of the forked chains due to the block.chainid has changed.Link to Code
Recommended Mitigation Steps
Recommend consider using this implementation, which recalculates the domain separator if the current block.chainid is not the cached chain ID.