High-risk actions aren't all covered by the existing checks
The governance contract's high-risk check does not treat kernel migration or changes to the high-risk module list as high-risk actions. An attacker could exploit this to brick the protocol or lower the quorum threshold for high-risk operations.
IllIllI Follow with LTDingZhen, cawfree and 1 other
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-01-olympus-on-chain-governance-judging/issues/104
Found by
IllIllI, LTDingZhen, cawfree, ck
Summary
Things such as changing the list of high risk operations, or migrating kernels are not counted as high risk, even though they are high-risk
Vulnerability Detail
High risk modules are checked against a mapping, but the changing of values within the mapping is not marked as high risk.
In addition, the MigrateKernel action is not protected, even though it can brick the protocol
Impact
Allows an attacker to brick the protocol with a low threshold, or to remove the high-risk modules from the list of high risk modules, resulting in a lower threshold Violates invariant of high-risk actions needing to be behind a higher quorum
Code Snippet
MigrateKernel isn't considered high-risk, and neither are calls to _setModuleRiskLevel():
// File: src/external/governance/GovernorBravoDelegate.sol : GovernorBravoDelegate._isHighRiskProposal() #1
647 @> // If the action is upgrading a module (1)
648 if (action == 1) {
649 // Check if the module has a high risk keycode
650 if (isKeycodeHighRisk[Module(actionTarget).KEYCODE()]) return true;
651 }
652 @> // If the action is installing (2) or deactivating (3) a policy, pull the list of dependencies
653 else if (action == 2 || action == 3) {
654 // Call `configureDependencies` on the policy
655 Keycode[] memory dependencies = Policy(actionTarget)
656 .configureDependencies();
657
658 // Iterate over dependencies and looks for high risk keycodes
659 uint256 numDeps = dependencies.length;
660 for (uint256 j; j < numDeps; j++) {
661 Keycode dep = dependencies[j];
662 if (isKeycodeHighRisk[dep]) return true;
663 }
664: }
Tool used
Manual Review
Recommendation
Add those operations to the high risk category
Discussion
sherlock-admin2
1 comment(s) were left on this issue during the judging contest.
haxatron commented:
Medium. Bypass of a non-critical security feature for MigrateKernel(). I would say setModuleRiskLevel() part doesn't count because it requires 2 proposals to succeed. Nice catch!
0xLienid
Fix: https://github.com/OlympusDAO/bophades/pull/298
IllIllI000
The PR properly adds the operations in the recommendation to the list of what's considered high risk, as well as the recommendations from all of the duplicates. This is done by returning true for anything with a target of the timelock or delegator, or for any kernel migration or executor change. The PR also adds tests.
s1ce
Escalate
This is an informational issue. There are comments in the code which specifically describe the modules that the sponsors consider to be high risk , so would consider this to be a design decision.
For example, the following comments:
// If the action is upgrading a module (1)
// If the action is installing (2) or deactivating (3) a policy, pull the list of dependencies
sherlock-admin2
Escalate
This is an informational issue. There are comments in the code which specifically describe the modules that the sponsors consider to be high risk , so would consider this to be a design decision.
For example, the following comments:
// If the action is upgrading a module (1)
// If the action is installing (2) or deactivating (3) a policy, pull the list of dependencies
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
nevillehuang
@IllIllI000 any comments? I think this is not informational, because sensitive actions like this should consistently have appropriate quorums in place and not break the high risk invariant allowing for execution with lower votes than normal. This cannot be seen as a documentation and design decision error given an explicit fix has been made.
However, considering the veto mechanism, I can see where @s1ce is coming from.
IllIllI000
I think the Sherlock team will need to decide what they want to do for this sort of case, since bricking the protocol is an unambiguously dangerous ability, and the purpose of the feature is to prevent that sort of thing (or else why not just rely on vetos for everything). The readme also says The proposal can be vetoed at any time (before execution) by the veto guardian. Initially, this role will belong to the DAO multisig. However, once the system matures, it could be set to the zero address., so at some point in the future, there will be nobody to veto anything.
0xLienid
Personally think this is a medium. These are definitionally high risk changes.
nevillehuang
I think the Sherlock team will need to decide what they want to do for this sort of case, since bricking the protocol is an unambiguously dangerous ability, and the purpose of the feature is to prevent that sort of thing (or else why not just rely on vetos for everything). The readme also says
The proposal can be vetoed at any time (before execution) by the veto guardian. Initially, this role will belong to the DAO multisig. However, once the system matures, it could be set to the zero address., so at some point in the future, there will be nobody to veto anything.
Extremely good point, I think this should remain as medium severity.
Czar102
Agree with @nevillehuang, @0xLienid and @IllIllI000. It seems managing policies is strictly safer than migrating the whole kernel.
Planning to reject the escalation and leave the issue as is.
Czar102
Result: Medium Has duplicates
sherlock-admin
Escalations have been resolved successfully!
Escalation status:
- s1ce: rejected
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 high-risk check only inspects module upgrades and policy installations/deactivations, omitting kernel migration and changes to the risk-level mapping.
What the attacker needed
A governance proposal; enough votes to meet lower quorum
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.
In this system, some actions are supposed to need more votes because they are dangerous. The code that decides which actions are dangerous missed two important ones: moving the core contract and changing the list of dangerous actions. So an attacker could do these dangerous things with fewer votes than intended.
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.