Open code423n4 opened 1 year ago
0xSorryNotSorry marked the issue as primary issue
AustinGreen marked the issue as sponsor disputed
Although this would be true if the deploy function in LlamaFactory
was public, it is not so it's not an immediate issue. That being said we aim to build towards a more permissionless future so we will discuss internally and decide if we should take action on it now.
AustinGreen marked the issue as sponsor acknowledged
AustinGreen marked the issue as disagree with severity
gzeon-c4 changed the severity to QA (Quality Assurance)
gzeon-c4 marked the issue as grade-b
We decided to follow the warden's recommendation and add msg.sender
to the salt
Lines of code
https://github.com/code-423n4/2023-06-llama/blob/aac904d31639c1b4b4e97f1c76b9c0f40b8e5cee/src/LlamaCore.sol#L638 https://github.com/code-423n4/2023-06-llama/blob/aac904d31639c1b4b4e97f1c76b9c0f40b8e5cee/src/LlamaCore.sol#L658 https://github.com/code-423n4/2023-06-llama/blob/aac904d31639c1b4b4e97f1c76b9c0f40b8e5cee/src/LlamaFactory.sol#L253 https://github.com/code-423n4/2023-06-llama/blob/aac904d31639c1b4b4e97f1c76b9c0f40b8e5cee/src/LlamaFactory.sol#L249
Vulnerability details
Impact
There are various instances where the
Clones.cloneDeterministic
is used by Open Zeppelin to deploy clones of certain contracts to be used. See the explanation of OZ:As you can see a salt is used to deploy the clone to a certain address, however, the salt uses in the examples provided area can be used by anyone to deploy to the same address Llama wants to deploy the instances of
llamaCore
,llamaStrategy
orllamaAccount
.Proof of Concept
Let's look at how this would happen in
LlamaFactory
for example:_deploy
is called from the constructor or fromdeploy
, its goal is to deploy a llama instance, this is policy and a llamaCore contract. It does this by using clones.CloneDeterministic. It's very easy to frontrun the transaction and deploy a clone to the same address, this would result in all these function calls to revert and it would be impossible to deploy using the same salt.For example a grifter sees the transaction in the mempool and calls:
This will deploy a
policy
contract at the same address, the legitimate call will revert and the user would need to choose another name that can be grifted again.Tools Used
Recommended Mitigation Steps
Add
msg.sender
to the salt:Assessed type
DoS