Closed code423n4 closed 1 year ago
0xSorryNotSorry marked the issue as primary issue
outdoteth marked the issue as sponsor confirmed
outdoteth marked the issue as sponsor acknowledged
outdoteth marked the issue as disagree with severity
If the implementaton is changed, older pools will not be trackable, but new pools will be predictable
I also believe the logic can be easily re-implemented by integrators
The newly deployed pool address is also returned after creating: https://github.com/code-423n4/2023-04-caviar/blob/cd8a92667bcb6657f70657183769c244d04c015c/src/Factory.sol#L84
For those reasons, also considering that the function is view and is not used anywhere else am downgrading to QA Low
GalloDaSballo changed the severity to QA (Quality Assurance)
GalloDaSballo marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2023-04-caviar/blob/cd8a92667bcb6657f70657183769c244d04c015c/src/Factory.sol#L168
Vulnerability details
Impact
A new pool is created using the Factory.create() function, which takes a salt parameter to calculate the address of the new pool:
https://github.com/code-423n4/2023-04-caviar/blob/cd8a92667bcb6657f70657183769c244d04c015c/src/Factory.sol#L92
It can be assumed that the public function
predictPoolDeploymentAddress(salt)
can be used by other developers and integrators to quickly calculate the addresses of previously deployed pools.However, the Factory administrator can change the address of the pool implementation using the
setPrivatePoolImplementation()
function. In this case, the functionpredictPoolDeploymentAddress(salt)
will return a new address for an old salt:https://github.com/code-423n4/2023-04-caviar/blob/cd8a92667bcb6657f70657183769c244d04c015c/src/Factory.sol#L165-L170
This means that if a developer or integrator creates a pool with their own salt and then looks for their pool using the public
predictPoolDeploymentAddress(salt)
method, then in the future, when the administrator changes theprivatePoolImplementation
, a different address will be returned for the samesalt
.This could allow an attacker to deploy their own pool with unexpected balances and attack the protocols or bots that mistakenly believed that the pool address for a particular salt would remain unchanged.
Recommended Mitigation Steps
It is recommended to either make the predictPoolDeploymentAddress() function private so that other developers are not tempted to use it, or to add the
privatePoolImplementation
parameter to the function so that the developer can obtain the exact address of previously deployed pools.