the GameType public respectedGameType variable in the OptimismPortal2.sol is set in the constructor, because it is a base contract that will be deployed behind a proxy, the proxy might have another value stored in the respectedGameType slot, or it might be empty.
Vulnerability Detail
because of this, the value the deployer expects will be the respectedGameType will be different because it is set in the base contract and not in the proxy contract.
Impact
if the GameType at the respectedGameType` slot is vulnerable, an attacker can use that to target portals before this value is reset.
Code Snippet
Tool used
Manual Review.
Recommendation
set the GameType respectedGameType in the function initialize instead of the constructor.
FonDevs
medium
respectedGameType
is set in the constructor and not in the initializer functionhttps://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/L1/OptimismPortal2.sol#L127C11-L162C6
Summary
the
GameType public respectedGameType
variable in theOptimismPortal2.sol
is set in the constructor, because it is a base contract that will be deployed behind a proxy, the proxy might have another value stored in therespectedGameType
slot, or it might be empty.Vulnerability Detail
because of this, the value the deployer expects will be the
respectedGameType
will be different because it is set in the base contract and not in the proxy contract.Impact
if the
GameType
at the respectedGameType` slot is vulnerable, an attacker can use that to target portals before this value is reset.Code Snippet
Tool used
Manual Review.
Recommendation
set the
GameType respectedGameType
in thefunction initialize
instead of theconstructor
.Duplicate of #88