LibProposing:proposeBlock allows blocks with a zero parentMetaHash to be proposed after the genesis block and avoid parent block verification
The proposeBlock function only checks the parentMetaHash when the supplied value is non-zero, so a proposer can submit a block with a zero parentMetaHash after genesis. This lets a malicious proposer create blocks that bypass parent verification, causing honest provers to fail with a mismatch error and potentially forfeit their validity bond.
Originally disclosed on Code4rena
Submitted by joaovwfreire
The proposeBlock at the LibProposing library has the following check to ensure the proposed block has the correct parentMetaHash set:
function proposeBlock(
TaikoData.State storage _state,
TaikoData.Config memory _config,
IAddressResolver _resolver,
bytes calldata _data,
bytes calldata _txList
)
internal
returns (TaikoData.BlockMetadata memory meta_, TaikoData.EthDeposit[] memory deposits_)
{
...
if (params.parentMetaHash != 0 && parentMetaHash != params.parentMetaHash) {
revert L1_UNEXPECTED_PARENT();
}
...
}
However, there are no sanity checks to ensure params.parentMetaHash is not zero outside of the genesis block.
Impact
Malicious proposers can propose new blocks without any parentMetaHash. This can induce a maliciously-generated block to be artificially contested as the final block relies on data held by the meta_ variable. Snippet 1:
TaikoData.Block memory blk = TaikoData.Block({
metaHash: keccak256(abi.encode(meta_)),
...
})
This also generates issues for independent provers, as they may not utilize the proposed block’s data to attempt to prove it and utilize the correct parentMetaHash, which will make the LibProving:proveBlock call revert with an L1_BLOCK_MISTATCH error:
function proveBlock
...
if (blk.blockId != _meta.id || blk.metaHash != keccak256(abi.encode(_meta))) {
revert L1_BLOCK_MISMATCH();
}
...
}
Also, according to the documentation, If the parent block hash is incorrect, the winning transition won’t be used for block verification, and the prover will forfeit their validity bond entirely. If a maliciously proposed block with zero parent block hash is contested and a higher-tier prover ends up proving the proposed block, then he/she loses its own validity bond.
Proof of Concept
The test suite contains the TaikoL1TestBase:proposeBlock that creates new block proposals with a zero parentMetaHash. This is called multiple times at tests like testL1*verifyingmultipleblocksonce and testL1_multipleblocksinone*L1_block at the TaikoL1.t.sol test file, demonstrating the lack of reversion if the parentMetaHash is not zero outside of the genesis block.
Recommended Mitigation Steps
Make sure to check the parentMetaHash value is not zero if it isn’t at the genesis block, otherwise users are going to be able to wrongly induce contestations.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the parentMetaHash validation is conditional on the supplied value being non-zero, so a zero value skips the parent check entirely instead of being rejected outside genesis.
Impact
A malicious proposer could create blocks that bypass parent verification, causing honest provers to hit a mismatch error and, if they win a contest on such a block, forfeit their validity bond.
What the attacker needed
Ability to propose blocks; block after genesis
The fix
The code should reject a zero parentMetaHash for any block other than the genesis block.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A blockchain stores blocks in a chain, and each new block should point to the block before it so everyone can check the history. Here the code only compares that pointer when the proposer supplies one, so a proposer can leave it empty and skip the check. Honest people trying to prove the block then use the real pointer, get a mismatch, and may lose money they put up as a guarantee.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.