the check for the calldatasize to prevent it from being too large is done in the FaultDisputeGamefunction initialize instead of the DisputeGameFactoryfunction create. this allows multiple dispute games for the same output proposal to be created.
Vulnerability Detail
the solidity opcode calldatasize returns the size of the calldata in the current environment.
assembly {
// change the check from 0x66 to 0x
if gt(calldatasize(), 0x66) {
// Store the selector for `ExtraDataTooLong()` & revert
mstore(0x00, 0xc407e025)
revert(0x1C, 0x04)
}
}
so when the above check is done in the FaultDisputeGamefunction initialize instead of the DisputeGameFactoryfunction create since the calldatasize in the function initialize is constant, large bytes calldata _extraData can be used to create multiple dispute games because the hash will be different for different _extraData arguments.
Impact
this allows multiple dispute games for the same output proposal to be created.
the code block to check the calldatasize should be done in the function create in the DisputeGameFactory instead of the function initialize in the FaultDisputeGame.
the check for the expected calldatasize should be equal to ---
FonDevs
high
Incorrect check if the calldatasize is too large when creating a new
GameType
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/DisputeGameFactory.sol#L107
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/main/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L546C11-L552C10
Summary
the check for the calldatasize to prevent it from being too large is done in the
FaultDisputeGame
function initialize
instead of theDisputeGameFactory
function create
. this allows multiple dispute games for the same output proposal to be created.Vulnerability Detail
the solidity opcode
calldatasize
returns the size of the calldata in the current environment.so when the above check is done in the
FaultDisputeGame
function initialize
instead of theDisputeGameFactory
function create
since the calldatasize in thefunction initialize
is constant, largebytes calldata _extraData
can be used to create multiple dispute games because the hash will be different for different_extraData
arguments.Impact
this allows multiple dispute games for the same output proposal to be created.
Code Snippet
Tool used
Manual Review
Recommendation
the code block to check the calldatasize should be done in the
function create
in theDisputeGameFactory
instead of thefunction initialize
in theFaultDisputeGame
.the check for the expected calldatasize should be equal to ---
Duplicate of #203