User with disapproval role can gas grief the action executor
A user with the disapproval role can cast a disapproval after the minimum execution time has passed, causing any subsequent execute call to fail. This allows gas griefing of the executor.
dirk_y Follow with rvierdiiev
Originally disclosed on Code4rena
Submitted by dirk_y, also found by rvierdiiev
Because disapprovals can be cast after the minimum queue time has expired (i.e. the action is now executable), a user with the disapproval role can frontrun any execute calls to push the action into the disapproved state and cause the execute call to fail, hence gas griefing the execute caller. This is particularly easy to achieve if a user has a force disapproval role.
Proof of Concept
During calls to castDisapproval there is a call to _preCastAssertions which checks that the action is in a queued state. The purpose of this check is to ensure that disapprovals can only be cast after the action was first approved and then queued for execution.
However, the issue is that the action remains in the queue state even after the minExecutionTime has been passed. The result is that a malicious user can disapprove an action once it is ready to execute.
Below is a diff to the existing test suite that shows how an action that is ready to be executed could be disapproved just before execution. This isn’t demonstrated with a force disapproval role, but that case would be the most harmful in terms of gas griefing.
diff --git a/test/LlamaCore.t.sol b/test/LlamaCore.t.sol
index 8135c93..34fd630 100644
--- a/test/LlamaCore.t.sol
+++ b/test/LlamaCore.t.sol
@@ -1015,8 +1015,12 @@ contract ExecuteAction is LlamaCoreTest {
mpCore.queueAction(actionInfo);
vm.warp(block.timestamp + 6 days);
- vm.expectEmit();
- emit ActionExecuted(0, address(this), mpStrategy1, actionCreatorAaron, bytes(""));
+ vm.prank(disapproverDave);
+ mpCore.castDisapproval(uint8(Roles.Disapprover), actionInfo, "");
+ vm.prank(disapproverDrake);
+ mpCore.castDisapproval(uint8(Roles.Disapprover), actionInfo, "");
+
+ vm.expectRevert();
mpCore.executeAction(actionInfo);
}
Recommended Mitigation Steps
I suggest that disapprovals should only be allowed to be cast whilst the timestamp is still less than the minExecutionTime of the action. Effectively there is a specified disapproval window. The following lines could be added to _preCastAssertions:
if (!isApproval) {
require(block.timestamp < action.minExecutionTime, "Missed disapproval window");
}
AustinGreen (Llama) confirmed and commented:
We confirm this and are working on a fix. It is a duplicate of https://github.com/code-423n4/2023-06-llama-findings/issues/80
Not sure if it should be medium or not but don’t feel strongly. Llama is a trusted system so this would require malicious user intent or user error.
This is more of an improved design than a security issue.
disapprovalrole is a highly privileged role as per the design of the system.The
minExecutionTimeis meant to prevent someone from executing the action early but is not designed to prevent thedisApprovalrole. Either he disapproved early or afterminExecutionTimepassed this doesn’t break the logic of the function at all, it will be excepted to cancel the action in this case. I believe this is a valid QA.
AustinGreen (Llama) confirmed and commented:
We removed the ability to disapprove after minExecutionTime to address this finding.
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 disapproval function only checks that the action is queued, not that the current time is before the minimum execution time, so disapprovals can be cast after the action becomes executable.
Impact
A disapprover can cause execute calls to fail, wasting the gas of the caller; the report notes this is particularly easy with a force disapproval role.
What the attacker needed
User has disapproval role; action is queued and past minExecutionTime
The fix
The ability to disapprove after minExecutionTime was removed to address this finding.
How it was found
- An action is approved and queued.
- The minimum execution time passes, making the action executable.
- A user with the disapproval role calls castDisapproval on the action.
- The action becomes disapproved.
- Any subsequent executeAction call reverts.
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, actions must be approved and then wait a minimum time before they can be executed. A user with a special 'disapproval' role can cancel an action by disapproving it. The problem is that they can disapprove even after the waiting period is over, just before someone tries to execute it, making that person waste gas on a failed transaction.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.