Closed c4-submissions closed 1 year ago
raymondfam marked the issue as low quality report
raymondfam marked the issue as duplicate of #129
alex-ppg marked the issue as not a duplicate
The Warden appears to not understand what the loop within the SafeDeployer::_createSafe
function is meant for.
Essentially, the loop will attempt to deploy a multi-signature wallet and will retry if a wallet has already been deployed at the relevant address. As such, the nonce will increase only when a multi-signature wallet has actually been deployed at the relevant address.
alex-ppg marked the issue as unsatisfactory: Invalid
A slight misbehaviour that may arise in the current code is that the nonce of an owner-set hash is not tied to the salt being utilized.
As such, it is possible for the nonce to not represent the actual number of wallets deployed for a particular hash. It will, however, represent at least the minimum number of wallets deployed for an owner-set.
The Sponsor is advised to evaluate whether they wish to attach owner-sets with the salt_
being used to avoid potential griefing attacks in cross-chain deployments.
The Warden remains ineligible for a reward given that the above misbehaviour is not actually identified in their submission.
Lines of code
https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/SafeDeployer.sol#L253-L255
Vulnerability details
Impact
In
SafeDepoyer
, a consoleAccount and a subAccount can be created using eitherdeployConsoleAccount
ordeploySubAccount
. Both these functions will make an internal call to_createSafe
. In_createSafe
there is ado-while
loop that tries to deploy a gnosis proxy using these parametersgnosisSafeSingleton, _initializer, nonce
.If this deployment fails with the
_SAFE_CREATION_FAILURE_REASON
error message, the deployment will be tried again by generating a new nonce:Here lays the problem.
Proof of Concept
Consider the following:
deployConsoleAccount
_SAFE_CREATION_FAILURE_REASON
do-while
loop, the deployment will be tried again by generating a new nonce using_genNonce
:ownerSafeCount
will be updated+1
without having deployed a new safe.ownerSafeCount
will be displaying the wrong data, leading to unexpected behaviour in the future.Tools Used
Manual Review
Recommended Mitigation Steps
Use another variable in the nonce calculation instead of
ownerSafeCount
. UpdateownerSafeCount
after a successful deployment.Assessed type
Other