Open c4-bot-5 opened 8 months ago
minhquanym marked the issue as primary issue
minhquanym marked the issue as sufficient quality report
This is a valid bug report, it has been fixed already here: https://github.com/taikoxyz/taiko-mono/pull/16543
dantaik (sponsor) confirmed
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
Hi @0xean! Just like to highlight a few things here, even though this report does provide a coded POC, it does not provide context or show impact of the bug on the protocol as is provided by the two reports marked as duplicates, one of which is mine. Those two reports provided some context and explained in detail via code snippets the issue and its impact on protocol.
Furthermore I am uncertain whether Medium is sufficient here, my report was marked as high because of the context of this bug. In the case that the top tier prover cannot reprove a block because its post state was deemed invalid by offchain validations, the state of the blockchain will remain invalid which could cause a whole host of problems, where one can imagine a potential consequence of invalid states is loss of funds.
Thanks!
leaving this as judged. I don't see any report showing a direct loss of funds.
Lines of code
https://github.com/code-423n4/2024-03-taiko/blob/main/packages/protocol/contracts/L1/libs/LibProving.sol#L219-L236 https://github.com/code-423n4/2024-03-taiko/blob/main/packages/protocol/contracts/L1/libs/LibProving.sol#L389
Vulnerability details
Impact
In the
LibProving.proveBlock
function thetop tier prover
is allowed to prove a new transition as long as the new transition is different from the previous transition andassert
conditional checks pass.But the
assert condition
of this logic is wrong since it checks for thets.contestBond == 0
where as it should bets.contestBond == 1
since 1 is set as the default value forts.contestBond
parameter for gas savings as shown below:As a result of the even though code expects the top-tier prover to re-prove a different transition, the transaction will revert.
Proof of Concept
Add the following testcase
test_L1_GuardianProverCanOverwriteIfNotSameProof_test
to theTaikoL1LibProvingWithTiers.t.sol
test file.If you change the ts.contestBond == 0 to ts.contestBond == 1 in the second
assert
statement of theLibProving.proveBlock
function, the test will run successfully and transaction execution will succeed.Tools Used
Manual Review and VSCode
Recommended Mitigation Steps
Hence recommended to update the
ts.contestBond == 0
in the secondassert
statement tots.contestBond == 1
in theLibProving.proveBlock
function.Assessed type
DoS