Open c4-bot-5 opened 8 months ago
minhquanym marked the issue as primary issue
minhquanym marked the issue as sufficient quality report
dantaik (sponsor) confirmed
This is a valid bug report. The bug has been fixed in this PR: https://github.com/taikoxyz/taiko-mono/pull/16545
Good report, but I am not sure it qualifies as H severity and most likely should be M.
I think there is a pre-condition here ( a malicious watchdog).
2 β Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
would welcome more conversation during PJ-QA
0xean changed the severity to 2 (Med Risk)
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
Hey @0xean, Thanks for the review. Commenting here as the owner of #47. It's not only about:
I think there is a pre-condition here ( a malicious watchdog).
It's also about the fact that the watchdog has no way to safely suspend & unsuspend an unproven message, as described in my report.
Not sure if that qualifies this and #47 to be upgraded to High
or not, but thought it was important to highlight the fact.
Thanks!
Hey @0xean,
As the bridge watchdog is considered a trusted role, I believe this issue should be categorized as QA.
As per C4's Severity Categorization: "Mistakes in code only unblocked through admin mistakes should be submitted within a QA Report."
Thank you!
Hi @0xean, I believe this issue should be of QA-severity.
Overall, I believe this issue and it's duplicates serve QA at best.
Thank you for your time!
- The watchdog though only suspends messages if they were relayed (see relayer docs here). This automatically defies attack scenario 1. The attack is only possible if the watchdog unsuspends a fake message, which it won't since it's fake.
I believe we are mixing "relayed message" with a "message signal not yet to be received". #47 does not intend to assume a wrong input by watchdog or a malicious one. I believe therefore that #47 stands valid on its own. But it would certainly be very helpful to have the sponsor's technical insight on this before supplying any further arguments from my side.
I believe we are mixing "relayed message" with a "message signal not yet to be received"
Why would the watchdog suspend a message that was never relayed/signalled/created from the source chain though? I've linked the docs for that exact reason since it clearly cites how the watchdog suspends messages i.e. only after confirming the source.
Privilege escalation issues are uncapped according to C4 docs and can be both MED and HIGH.
Privilege escalation issues are judged by likelihood and impact and their severity is uncapped.
Bridge watcher is supposed to only be able to suspend and ban. The worst case is supposed to be DOS for a brief moment until the user is removed, instead they are able to drain the bridge.
Severity is clearly High. Likelihood is hard to assess. What we can see from the code is that Taiko has design the system to be minimally centralized, trusted roles have limited scope and upgrades has to go through the governance system. This vulnerability bypasses all of that and gives a single role the ability to drain all assets.
Agree that if this attack is feasible, it represents privilege escalation.
as pointed out previously:
Privilege escalation issues are judged by likelihood and impact and their severity is uncapped.
Would be useful to get one final comment from @dontonka / @adaki2004 but most likely will leave as judged.
tagged my mistake also on this issue π . @dantaik
Agree that if this attack is feasible, it represents privilege escalation.
as pointed out previously:
Privilege escalation issues are judged by likelihood and impact and their severity is uncapped.
Would be useful to get one final comment from @dontonka / @adaki2004 but most likely will leave as judged.
Judged.
tagged my mistake also on this issue π . @dantaik
sorry about that
Lines of code
https://github.com/code-423n4/2024-03-taiko/blob/f58384f44dbf4c6535264a472322322705133b11/packages/protocol/contracts/bridge/Bridge.sol#L82-L95 https://github.com/code-423n4/2024-03-taiko/blob/f58384f44dbf4c6535264a472322322705133b11/packages/protocol/contracts/bridge/Bridge.sol#L230-L231
Vulnerability details
Impact
The
bridge_watchdog
role can forge arbitrary messages and drain the bridge of all ETH and tokens.Proof of Concept
bridge_watchdog
can callsuspendMessasges()
to suspend and un-suspend a messagehttps://github.com/code-423n4/2024-03-taiko/blob/f58384f44dbf4c6535264a472322322705133b11/packages/protocol/contracts/bridge/Bridge.sol#L82-L95
When this function is called to un-suspend a message we set
proofReceipt[msgHash] = _timestamp
. If the msgHash was not proven before it will now be treated as proven since anymsgHash
with atimestamp != 0
is treated as provenhttps://github.com/code-423n4/2024-03-taiko/blob/f58384f44dbf4c6535264a472322322705133b11/packages/protocol/contracts/bridge/Bridge.sol#L230-L231
bridge_watchdog
can therefore forge arbitrary messages and have them treated as proven by first suspending them and then un-suspending them.bride_watchdog
is supposed to only be able to ban and suspend messages, in the expected worst casebridge_watchdog
is limited to DDOSing messages and bans until governance removes the thebridge_watchdog
.With the privilege escalation shown here the role can instead drain the bridge of all ETH and tokens.
POC
Here is a POC showing that we can forge an arbitrary message by suspending and un-suspending a message
To run this POC first change the following code in Bridge.t.sol so that we use a real signalService
Paste the below code and run into Bridge.t.sol and run
forge test --match-test testWatchdogDrain -vvv
Tools Used
foundry, vscode
Recommended Mitigation Steps
Un-suspended messages should be set to 0 and be proven or re-proven.
Assessed type
Other