Challenger misses discrepancy events, allowing executors to perform malicious actions
The Challenger bot's end-of-block handler overwrote the list of discrepancy challenges with timeout challenges before sending them, so discrepancy events were never sent for processing. A malicious Executor could therefore submit invalid output proposals without being challenged.
The Challenger is a critical process responsible for monitoring the Executor’s output proposals and challenging any invalid submissions. It ensures the integrity of the rollup’s state and prevents malicious actions by the Executor.
The Challenger operates by accumulating emitted events from both the L1 and L2 chains. At the end of every L2 block, a handler is triggered to validate the events and determine if any challenges need to be issued.
When a user deposits tokens into the L2 by sending an InitiateTokenDeposit transaction on the L1, the following event is emitted:
Checks for discrepancies in the mapped events, such as InitiateTokenDeposit and FinalizeTokenDeposit (1@).
Checks for timeout events among unprocessed pending events (2@).
Groups both types of events into pendingChallenges for later handling/challenging/rollbacks (3@).
However, at 4@, the handler sends only the challenges variable, which is overridden when fetching timeout events. This results in discrepancies being missed, as they are not included in pendingChallenges.
The SendPendingChallenges function sends these challenges to a channel (c.challengeCh) for asynchronous handling. The challengeHandler function, running in a separate goroutine, processes challenges from this channel, the discrepancy events won’t be included in this.
This defeats the purpose of the Challenger bot, allowing malicious Executors to act without detection.
I just want to mention that those challenges are currently not acted upon (e.g., not sent to an alerting system, or actions and counter-measures taken):
@berndartmueller - The protocol already has those challenges errored out in the logs, which are, of course, caught somewhere else on their end. If you’re referencing the TODO, it is an improvement for later. This doesn’t change the fact that the discrepancy events are being thrown away.
Our responsibility here is to make sure it is caught alongside the timeout issues, which are not being caught. This is enough impact to show that this is a high-severity issue.
The original report as published on Code4rena, by 0xAlix2. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
The handler reused the same variable name for timeout challenges, overwriting the discrepancy challenges before they were passed to SendPendingChallenges.
Impact
Discrepancy challenges are never sent for processing, so a malicious Executor could act without detection; however, a warden noted that challenges are currently only logged and not acted upon, so the Challenger is not effective regardless.
What the attacker needed
Malicious or faulty Executor; Challenger bot running
The fix
The handler was fixed to send the combined pendingChallenges list instead of the overwritten challenges variable.
How it was found
A user deposits tokens on L1, emitting an InitiateTokenDeposit event that the Challenger stores.
The Executor finalises the deposit on L2, emitting a FinalizeTokenDeposit event that the Challenger also stores.
At the end of an L2 block, the handler checks for discrepancies and collects them into a challenges list.
The handler then checks for timeouts, overwriting the challenges variable with the timeout results.
Only the overwritten challenges variable is sent to SendPendingChallenges, so the discrepancy findings are dropped.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A rollup has a watchdog program called the Challenger that checks whether the operator (the Executor) is cheating. When the watchdog found a mismatch between a deposit and its finalisation, it put that finding in one list, but then replaced that list with a different list of timeout findings before sending anything onward. So the cheating was noticed but the alarm was thrown away.
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.