OptimismPortal2 not initialized respectedGameTypeUpdatedAt will allow games created before the upgrade
Summary
The OptimismPortal2 uses the respectedGameTypeUpdatedAt to prevent games created before the gameType is respected.
The respectedGameTypeUpdateAt will be set to the timestamp when setRespectedGameType is called.
However, the default gametype is zero (CANNON), so before the guardian can set via setRespectedGameType, a malicious actor can use a game created at any time in the past.
Vulnerability Detail
The OptimismPortal2::initialize function does not set the respected game type and the respectedGameTypeUpdatedAt.
As the result, users can use the CANNON game to prove their withdrawals as soon as the OptimismPortal2 is deployed.
But, per the comment in the checkWithwal function, the respectedGameTypeUpdatedAt is set to prevent using games deployed before the guardian is watching.
Since it is still set to zero, the checkWithdrawal will allow any game to be used.
For whatever reason, (for example testing), if the factory and game contracts are deployed before the upgrade of the OptimismPortal2, it may be a problem, since it may allow invalid withdraw to finalized.
Impact
The unset respectedGameTypeUpdatedAt may let games deployed at any time can be used, therefore may result in finalizing invalid withdrwal
lemonmon
medium
OptimismPortal2
not initializedrespectedGameTypeUpdatedAt
will allow games created before the upgradeSummary
The
OptimismPortal2
uses therespectedGameTypeUpdatedAt
to prevent games created before the gameType is respected. TherespectedGameTypeUpdateAt
will be set to the timestamp whensetRespectedGameType
is called. However, the default gametype is zero (CANNON), so before the guardian can set viasetRespectedGameType
, a malicious actor can use a game created at any time in the past.Vulnerability Detail
The
OptimismPortal2::initialize
function does not set the respected game type and therespectedGameTypeUpdatedAt
.https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/L1/OptimismPortal2.sol#L147-L162
It will result in default value (zero) for both
respectedGameTypeUpdatedAt
andrespectedGameType
. The default GameType zero is CANNON.https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/libraries/DisputeTypes.sol#L104
As the result, users can use the CANNON game to prove their withdrawals as soon as the OptimismPortal2 is deployed.
But, per the comment in the checkWithwal function, the
respectedGameTypeUpdatedAt
is set to prevent using games deployed before the guardian is watching.Since it is still set to zero, the
checkWithdrawal
will allow any game to be used.https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/L1/OptimismPortal2.sol#L502-L507
For whatever reason, (for example testing), if the factory and game contracts are deployed before the upgrade of the OptimismPortal2, it may be a problem, since it may allow invalid withdraw to finalized.
Impact
The unset
respectedGameTypeUpdatedAt
may let games deployed at any time can be used, therefore may result in finalizing invalid withdrwalCode Snippet
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/L1/OptimismPortal2.sol#L147-L162
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/libraries/DisputeTypes.sol#L104
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/L1/OptimismPortal2.sol#L502-L507
Tool used
Manual Review
Recommendation
Consider setting the GameType and
respectedGameTypeUpdatedAt
at the initialize functionDuplicate of #85