Open code423n4 opened 1 year ago
The issue is well demonstrated, properly formatted, contains a coded POC. Marking as HQ.
0xSorryNotSorry marked the issue as high quality report
0xSorryNotSorry marked the issue as primary issue
AustinGreen marked the issue as sponsor confirmed
This finding was addresses in this PR: https://github.com/llamaxyz/llama/pull/384 (note our repo is private until we launch)
gzeon-c4 marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-06-llama/blob/main/src/strategies/LlamaRelativeQuorum.sol#L199-#L210
Vulnerability details
Impact
Anyone can change approval/disapproval threshold for any action using LlamaRelativeQuorum strategy.
Proof of Concept
When a new action is created with
LlamaRelativeQuorum
strategy,LlamaCore
will call functionvalidateActionCreation
which is currently implemented as below:The last 2 lines of code is to
Save off the supplies to use for checking quorum
. The 2 variablesactionApprovalSupply
andactionDisapprovalSupply
are described asMapping of action ID to the supply of the approval/disapproval role at the time the action was created.
This means the strategy will save the total supply of approval/disapproval role at creation time and then use them to calculate the approval/disapproval threshold, which equals to (approval/disapproval percentage) * (total supply of approval/disapproval). However, since the functionvalidateActionCreation
's scope isexternal
and does not require any privilege to be called, any user can call this function and update the total supply of approval/disapproval role to the current timestamp and break the intention to keep total supply of approval/disapproval roleat the time the action was created
. This issue is highly critical because many Llama protocol's functions depend on these 2 variables to function as intended.For example, if the total supply of approval role is 10 at the creation of action and the
minApprovalPct
= 100% - which means requires all policy holders to approve the action to pass it. If it then be casted 9 votes (1 vote short), the action's state is still Active (not approved yet). However, if 1 user is revoked their approval/role, anyone can call functionvalidateActionCreation
and update the required threshold to 9 votes and thus the action's state becomes Approved.Below is a POC for the above example, for ease of testing, place this test case under file
LlamaStrategy.t.sol
, contractIsActionApproved
:Tools Used
Manual review
Recommended Mitigation Steps
Since the intention is to keep values
actionApprovalSupply
andactionDisapprovalSupply
snapshot at creation time for every action andLlamaCore
only callvalidateActionCreation
at creation time, I think the easiest way is to allow onlyllamaCore
to call this function.Assessed type
Access Control