The decision to return the liveness bond depends solely on the last guardian
The guardian multisig approved a message hash that covered only the block metadata and transition, not the proof data. The last guardian to approve could therefore supply arbitrary proof data, including the special value that releases the liveness bond, deciding alone whether the assigned prover gets the bond back.
alexfilippov314 Follow with t0x1c
Originally disclosed on Code4rena
Submitted by alexfilippov314, also found by t0x1c
Vulnerability details
The GuardianProver contract is a multisig that might contest any proof in some exceptional cases (bugs in the prover or verifier). To contest a proof, a predefined number of guardians should approve a hash of the message that includes _meta and _tran.
function approve(
TaikoData.BlockMetadata calldata _meta,
TaikoData.Transition calldata _tran,
TaikoData.TierProof calldata _proof
)
external
whenNotPaused
nonReentrant
returns (bool approved_)
{
if (_proof.tier != LibTiers.TIER_GUARDIAN) revert INVALID_PROOF();
bytes32 hash = keccak256(abi.encode(_meta, _tran));
approved_ = approve(_meta.id, hash);
if (approved_) {
deleteApproval(hash);
ITaikoL1(resolve("taiko", false)).proveBlock(_meta.id, abi.encode(_meta, _tran, _proof));
}
emit GuardianApproval(msg.sender, _meta.id, _tran.blockHash, approved_);
}
The issue arises from the fact that the approved message doesn’t include the _proof. It means that the last approving guardian can provide any desired value in the _proof. The data from the _proof is used to determine whether it is necessary to return the liveness bond to the assigned prover or not:
if (isTopTier) {
// A special return value from the top tier prover can signal this
// contract to return all liveness bond.
bool returnLivenessBond = blk.livenessBond > 0 && _proof.data.length == 32
&& bytes32(_proof.data) == RETURN_LIVENESS_BOND;
if (returnLivenessBond) {
tko.transfer(blk.assignedProver, blk.livenessBond);
blk.livenessBond = 0;
}
}
As a result, the last guardian can solely decide whether to return the liveness bond to the assigned prover or not.
Impact
The decision to return the liveness bond depends solely on the last guardian.
Recommended Mitigation Steps
Consider including the _proof in the approved message.
bytes32 hash = keccak256(abi.encode(_meta, _tran, _proof));
dantaik (Taiko) confirmed and commented:
Now guardian provers must also agree on whether liveness bond should be returned bytes32(proof.data) == LibStrings.HRETURNLIVENESSBOND, so the hash they sign is now:
bytes32 hash = keccak256(abi.encode(_meta, _tran, _proof.data));
rather than the previous code:
bytes32 hash = keccak256(abi.encode(_meta, _tran));
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
The approval hash was computed over the metadata and transition only, omitting the proof whose data controls the liveness bond refund.
What the attacker needed
Guardian role in the multisig; last guardian to approve
The fix
The approval hash was changed to include the proof data, so all guardians must agree on whether the liveness bond is returned.
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 group of trusted guardians vote by signing a summary of a proposed action. The summary left out one part of the action, the extra proof data, so the final voter could quietly change that part without breaking anyone's signature. That let one guardian alone decide whether a deposit (the liveness bond) was returned to a prover.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.