Open code423n4 opened 1 year ago
We accept it but we are not sure about the severity here, Medium might be too much.
donosonaumczuk marked the issue as disagree with severity
Interesting finding. I think it is of QA severity as the protocol is not multichain, so replay attacks on the "forked copy" of Lens aren't really an issue
Picodes changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2023-07-lens/blob/main/contracts/libraries/MetaTxLib.sol#L450-L453
Vulnerability details
Bug Description
In
MetaTxLib.sol
, the domain seperator for theLensHub
contract on Polygon is precomputed and stored as a constant:MetaTxLib.sol#L25-L39
It is then used in
calculateDomainSeparator()
as the EIP-712 domain separator when verifying signatures for theLensHub
contract:MetaTxLib.sol#L450-L453
However, if Polygon ever hard forks, signature replay becomes possible across the original and forked chain. This is because
LENS_HUB_CACHED_POLYGON_DOMAIN_SEPARATOR
(which containsblock.chainid
) is pre-computed and will remain the same on the forked chain, even though its chain ID is different.Impact
If a chain hard forks, signature replay becomes possible across the original and forked chain. As
MetaTxLib
is mainly used to verify signatures for meta-transactions, such aspostWithSig()
, signatures that are used to execute such functions on one chain will become replayable on the other chain.Recommended Mitigation
Consider checking if
block.chainid
matches Polygon's chain ID before usingLENS_HUB_CACHED_POLYGON_DOMAIN_SEPARATOR
as the domain seperator:MetaTxLib.sol#L450-L453
Assessed type
Context